Hello, I was wondering if anyone knows a good way to handle restoring a backup taken with a m2m intermediary model.
I'm trying to upgrade from my sqlite database to a real database and would like to keep the data that was created thus far.
Basically the models look like this:...
So I've tried two approaches -- first problem was regarding the fact that SentRecord and Message refer to one another and so one has to be created first. dumpscript picked SentRecord to do first -- totally sensible. But It can't comply with the above model because the .message foreign key will create a column that enforces NOT NULL.
OK fine, I changed the above model to allow null on message, since it basically does this sequence:
1. create sent messages, with no message pk
2. create messages
3. then it *should* fill in the sent messages .message pk... but instead it blows up because because it generates stuff like this:
app_message_1.recipient.add( importer.locate_object(User, 'id', 1, ...You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGq7KhoAkw57YzmEZReouD7Fr9f0fX7mG-bhdGgSRu3Oc07xiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment