Changes between Initial Version and Version 19 of Ticket #21127


Ignore:
Timestamp:
07/20/15 17:35:00 (7 years ago)
Author:
Carl Meyer
Comment:

That looks to me like the thread consensus (and I agree with it).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21127

    • Property Cc hv@… flavio.curella@… added
    • Property Summary changed from on_delete=models.SET_NULL should be the default for nullable FKs to on_delete should be a required parameter for ForeignKey
    • Property Triage Stage changed from Unreviewed to Accepted
  • Ticket #21127 – Description

    initial v19  
     1(Update: consensus below was to make `on_delete` a required argument, rather than twiddling with its defaults.)
     2
    13This wasn't done when we added the `on_delete` feature due to concerns about breaking backwards-compatibility with the previous always-cascade-deletes behavior. But if you set aside legacy considerations, it seems intuitively obvious (to me anyway) that SET_NULL is a superior default for a nullable FK than CASCADE. And even if others might have a different intuition, the consequences of your intuition being wrong are far from symmetrical: one way you get a model instance with a null FK hanging around that you didn't expect to still have, the other way you get data loss.
    24
Back to Top