Reputation: 425
Why does Django not have an ON UPDATE setting for foreign keys? The ForeignKey model only has on_delete.
Upvotes: 4
Views: 792
Reputation: 562378
The reason why is the same reason why any feature is lacking in any product — no one has implemented it yet.
I would guess that on_update
is less commonly needed than on_delete
, because of the popularity of using auto-increment id's as primary keys, which most often have no need to be updated. So the feature of on_update
was not implemented.
There are a couple of feature requests in the Django tracker about this:
I don't know if the patch was integrated into any Django release. I'll leave that to you to research, or ask on a support forum.
Upvotes: 6