Changes between Initial Version and Version 19 of Ticket #21127


Ignore:
Timestamp:
Jul 20, 2015, 12:35:00 PM (9 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 Triage Stage UnreviewedAccepted
    • Property Cc hv@… flavio.curella@… added
    • Property Summary on_delete=models.SET_NULL should be the default for nullable FKson_delete should be a required parameter for ForeignKey
  • 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