[Django]-Django Import/Export to multiple Models (foreignkey)

6👍

Try

 store_name = fields.Field(column_name='store_name', attribute='Store',
                           widget=ForeignKeyWidget(Store, 'store_name'))

I suggest you name model field uncapitalized

It’s hard to understand what you are really asking.

If what you are saying is that “Want to create foreign key objects and fill the foreign object’s attribute with the excel data”

I think you need to do first create the foreign object and relate it to the other model which means, you would need to override or define a function in your ModelResource class and have it called from your admin.

👤eugene

1👍

They have a widget for this- http://django-import-export.readthedocs.org/en/latest/api_widgets.html. I do not understand how to use it tho.

👤Yian

Leave a comment