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.
--
Ticket URL: <https://code.djangoproject.com/ticket/21295>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 1
* needs_tests: => 0
* needs_docs: => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/21295#comment:1>
* cc: loic@… (added)
Comment:
Awesome work.
I just had a brief look at the diff, it will need special handling to be
compatible with migrations, my patch for #21275 addresses this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/21295#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/21295#comment:3>
* cc: emorley@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/21295#comment:4>
Comment (by Akash Kumar Sen):
This seems to be a interesting topic to work on, but I am not sure about
the ideal behavior of the {{{on_update}}} parameter. Some explanation
would be very helpful. Are we talking about something similar to the SQL
{{{ON UPDATE}}} clause here?
--
Ticket URL: <https://code.djangoproject.com/ticket/21295#comment:5>
* cc: Akash Kumar Sen (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/21295#comment:6>
* cc: Giannis Terzopoulos (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/21295#comment:7>