bmihelac/django-import-export — pull request #123 by darrylcousins (2014-07-31 11:08:34+00:00)
Title: Follow MRO to collect declared fields from parent classes and mixins

Following the pattern of django.forms.forms.DeclaritiveFieldsMetaClass the __new__ method has been changed to follow parent classes and pick up the declared fields. This allows:

class BaseResourceMixin(object):

name = fields.Field(
column_name='Name',
attribute='name'
)
description = fields.Field(
column_name='Description',
attribute='description'
)

class ThingResource(ResourceMixin, resources.ModelResource):

user = fields.Field(
column_name='User',
attribute='user',
widget=UserWidget(
get_model(*settings.AUTH_USER_MODEL.split('.'))
)
)

class Meta:
model = Thing
fields = ('name', 'description', 'user')

No tests yet but happily used as is.

Regards,
Darryl