django one-to-one relationship defaulting to existing object - is this what is supposed to happen?
I have three models, related with one-to-one relationships. So far as relevant, the code for them is:
class Member(models.Model):
deferred_on = models.OneToOneField('PendingAuthorisation',
related_name = 'defers_member',
on_delete=models.SET_NULL,
null=True,
blank=True,
default = None)
class Director(models.Model):
deferred_on = models.OneToOneField('PendingAuthorisation',
related_name = 'defers_director',
on_delete=models.SET_NULL,
null=True,
开发者_如何学运维 blank=True,
default = None)
class PendingAuthorisation(models.Model):
...
My issue is that when I create a new PendingAuthorisation
, it's defers_member
and defers_director
properties default to an existing Member
or Director
even if those objects do not have a deferred_on
property set.
Is this supposed to happen? Is there any way to stop this happening? Is this a bug in django?
edit: I'm using django 1.3 (not 1.3.1).
精彩评论