#14043: Incorrect and/or confusing behaviour with nullable OneToOneField -------------------------------------+------------------------------------- Reporter: theevilgeek | Owner: Type: Bug | Status: new Component: Database layer | Version: master (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: OneToOneField, | Needs documentation: 0 cascading delete, nullable | Patch needs improvement: 1 Has patch: 1 | UI/UX: 0 Needs tests: 1 | Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by akaariai): I can confirm that this does still happen in master. I tested with this in one_to_one_regress: {{{ def test_nullable_o2o_delete(self): u = UndergroundBar.objects.create(place=self.p1) self.p1.delete() self.assertTrue(UndergroundBar.objects.filter(pk=u.pk).exists()) self.assertIsNone(UndergroundBar.objects.get(pk=u.pk).place) }}} The attached patch isn't correct at all, it is explicitly breaking the link before delete and then confirming that delete doesn't cascade after that. That isn't the problem, the problem is that OneToOneField that is nullable should be set to None on delete, not cascaded. -- Ticket URL: <https://code.djangoproject.com/ticket/14043#comment:13> Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/069.1ab8b8b0f0a0afe720b3b8115cf1fcec%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.