Wiadomość napisana w dniu 2009-06-05, o godz. 14:06, przez Jarek Zgoda:

> 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.


Deep debug revealed that obj.object.fk is empty (so no chance to get  
obj.object.fk.prop), only obj.object.fk_id is set. Any idea how to get  
related object data from serialized dump?

-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to