-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import related models without static foreign keys #69
Comments
I've created this logic using plain pyexcel, but not sure how to obtain id of created question object to the
|
can you query it from django? https://github.com/pyexcel-webwares/django-excel/blob/master/polls/views.py#L76 |
if you use bulk creation, so that won't be possible. hence, you may want to do both in separate process. |
Hi, it can't be queried from the database because at this moment question not yet created, but when it will be created it will get auto-increment ID and no known pk will be available. |
Hi, I need to import two related sheets without static foreign in the database.
Referring to an example from the docs my "Question" sheet always needs to be appended to the database with auto-id and "Choice" rows need to be foreign to the Question using rel_id (but not write rel_id to the database, it is needed only for build relations during import.
As a result, the single Question unique field is
id
that created automatically by database auto increment.Thanks for any suggestions.
The text was updated successfully, but these errors were encountered: