I'm using django-import-export module to export the record. However, I couldn't export the generic relations. I just want to get all the details of GenericRelation.
Found the snippet below in Github but it doesn't work.
class DudeResource(resources.ModelResource):
address = fields.Field(
column_name='address',
attribute='address',
widget=widgets.ForeignKeyWidget(Address, 'name')) # use a unique field
class Meta:
model = Dude
fields = ['address']
My Models
Company
|-- Name
|--- Address(Generic Relation)
Address
|--content_type
|--object_id
|--content_object
|--line_1
|--line_2
|--city
|--country
I just need to import/export line_1, line_2, city, and country. Can someone help me on this? Thanks!