Hi,

I have two models in a one-to-one relationship: Phone and Antenna.

In other words, within the Phone class I have this field:
antenna = models.OneToOneField(Antenna, related_name='phone')

What I want to do, given a specific antenna, is to delete its phone
and add a different phone:

antenna.phone.delete()
phone = Phone()
phone.antenna = antenna
phone.save()

Problem: after these statements, antenna.phone.id is None. I was
expecting antenna.phone to reflect the new phone, which definitely has
an id assigned to it after the save().

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to