#14368: Reverse relation attribute for OneToOneField fails when set to None ---------------------------------------------------+------------------------ Reporter: gsakkis | Owner: nobody Status: new | Milestone: 1.3 Component: Database layer (models, ORM) | Version: 1.2 Resolution: | Keywords: OneToOneField, bug Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 1 | ---------------------------------------------------+------------------------ Changes (by gsakkis):
* needs_better_patch: 0 => 1 * has_patch: 0 => 1 Comment: According to the discussion on django-dev `[1]`, updating the database is the right thing to do and is consistent with the behaviour of ForeignKey for the analogous operation. Also the second assertion (`self.assert_(second.first is None)`) is impossible to enforce in general; at best you can do it for the existing cached related instance of `first`. For example the `second_copy` below will become stale, there is no way to magically update it: {{{ first = First.objects.create() second = Second.objects.create() first.second = second second.save() second_copy = Second.objects.get(pk=second.pk) self.assert_(second_copy.first is not None) first.second = None # this can be made to succeed self.assert_(second.first is None) # but this cannot self.assert_(second_copy.first is None) }}} I'm working on a patch too, will hopefully post it later today. `[1]` http://groups.google.com/group/django- developers/tree/browse_frm/thread/634499444687556f#doc_f1a254e8bf4ad8d9 -- Ticket URL: <http://code.djangoproject.com/ticket/14368#comment:9> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.