I think you would either have to assign the antenna's phone:
antenna.phone = phone
or refetch the antenna from the database so Django creates the object
with the newly-created reference. The antenna you are looking at is
only coming from memory when you do antenna.phone, not from the
database. Y
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.
2 matches
Mail list logo