Even though we have on_delete=PROTECTED on several models fields for a
reason, there are circumstances where we want to circumvent this
restriction also for a reason.
Would this be valuable addition to django?
--
Ticket URL: <https://code.djangoproject.com/ticket/26664>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_docs: => 0
* resolution: => wontfix
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
This seems a bit dangerous to me. In particular, there's no way to control
how far or to which relations the deletions will cascade. I think it's
safer to explicitly handle the deletions in a use case like this. Of
course, you can also override the `Model.delete()` method to have whatever
behavior you like.
If you can find consensus on the DevelopersMailingList to add something
like this, I'll be happy to reopen the ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/26664#comment:1>
Comment (by srkunze):
Hi Tim. I know that it might be dangerous. However, the reason why I
suggest this feature is that we needed it in a backwards migration. I.e.
it removes some data that has been created by its corresponding forward
migration. In this case, we are 110% sure that it does not delete anything
more than necessary.
Overriding ```Model.delete()``` does not help in this case as it is NOT
the original Model but a fake migration model.
We already have a helper function that carries out this deletion manually
but we thought that a Django-provided way would be much cleaner.
--
Ticket URL: <https://code.djangoproject.com/ticket/26664#comment:2>
Comment (by srkunze):
Proposal on DevelopersMailingList: https://groups.google.com/forum/#!topic
/django-developers/Rr0cX1ZEE-Y
--
Ticket URL: <https://code.djangoproject.com/ticket/26664#comment:3>