I need to copy some data between disconnected instances of an application. My first thought was to use serialization and deserialization, but I'm hitting one obstacle after another.
Now I am stuck at importing deserialized data with foreign keys (available in the same "dump"). I try to import objects in "right order" (first import referred, then referring), but objects "saved" earlier (referred) cann't be found when importing referring objects. The flow is like (obj is Django's DeserializedObject): try: instance = Model.objects.get(uniq_property=obj.object.uniq_property) # we have one already, no import necessary except Model.DoesNotExist: referred = OtherModel.objects.get(prop=obj.object.fk.prop) instance.fk = referred instance.pk = None obj.save() I'm getting OtherModel.DoesNotExist exception, even when the referred OtherModel instance has been succesfully imported and exists in database at the time of importing Model instance. Am I abusing Django serialization? -- Artificial intelligence stands no chance against natural stupidity Jarek Zgoda, R&D, Redefine jarek.zg...@redefine.pl --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---