Add on_update support
|Reported by:||Anssi Kääriäinen||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||loic@…, emorley@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||yes|
There are cases where on-update cascade support would be useful. Currently Django offers no way to cascade updates.
An experimental patch implementing on_update=models.CASCADE support for foreign keys is available from: https://github.com/akaariai/django/tree/update_cascade. It is based on composite foreign keys branch (https://github.com/akaariai/django/tree/soc2013/composite-fields).
I'll attach a sample project to this ticket. Unpack it, use the above mentioned branch of Django, run syncdb, runserver and try in admin. Note that the country/city names are stored locally in the models, so country name update cascades to cities and from cities to streets.