Changes between Initial Version and Version 19 of Ticket #21127
- Timestamp:
- 07/20/15 17:35:00 (8 years ago)
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
toon_delete should be a required parameter for ForeignKey
-
Property
Triage Stage
changed from
Unreviewed
toAccepted
-
Ticket #21127 – Description
initial v19 1 (Update: consensus below was to make `on_delete` a required argument, rather than twiddling with its defaults.) 2 1 3 This 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. 2 4