I believe I have done my due diligence, but point me in the right direction if I am missing something.
I am working on a generic importing engine to import various file formats(csv, fixed length, etc) into django models based on json formatted file definitions. It needs to do something like the following, which I have actually tried in the shell. zone_type = ZoneType() zone_type.name = 'GrowthArea' … zone = Zone() zone.type = zone_type zone.name = 'TX-Region12' #-save starts here zone.save() #-save ends here Is this supposed to work? I have also tried: #-save starts here zone_type.save() zone.save() #-save ends here Both report that the foreign key field is null such as: " null value in column "type_id" violates not-null constraint". This does work: #-save starts here zone_type.save() zone.type = zone_type zone.save() #-save ends here as does this: #-save starts here z.type.save() z.type = z.type z.save() #-save ends here I could do something like the last example in my code, but I'd rather not. It seems like this would be simple to do inside the model save logic. Am I missing something? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.