GenericForeignKey import/export
See original GitHub issueHow do you manage Generic Relations using django-import-export
?
A GenericForeignKey combines two informations to generate a relation: a content_type
and an object_id
.
Since each field
has his own logic in django-import-export
, I was thinking of using before_import_row
or before_save_instance
to define the combination of the above two fields.
Has anyone tried building a GenericForeignKeyWidget
?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:12
Top Results From Across the Web
The contenttypes framework | Django documentation
from django.contrib.contenttypes.fields import GenericForeignKey from ... Give your model a GenericForeignKey , and pass it the names of the two fields ...
Read more >Django Import/Export in a table where foreign key is a string ...
I have explored a lot of examples of Django export/import. When I try importing in a table with a foreign key with datatype...
Read more >Django Import Export Tricks & Tips - Dev Genius
Tips for using import-export with its special features. Importing Exporting of data in Django becomes easier with its special library Django Import Export...
Read more >Creating models for diverse content | Django 2 by Example
from django.contrib.contenttypes.fields import GenericForeignKey. Copy. Then, add the following code to the end of the file: class Content(models.Model):
Read more >Django QuerySet to CSV Files & Datasets - Blog Post
analytics.models.py from django.conf import settings from ... models from django.contrib.contenttypes.fields import GenericForeignKey from ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Using
ForeignKeyWidget
to get theGenericRelation
didn’t work.I was able to import/export a generic foreign key using the built-in ForeignKey widget.