Tuesday, April 26, 2016

Re: Django apparently can't handle that error.

On Tue, Apr 26, 2016 at 10:02:32AM -0700, Neto wrote:
> The right is just Account.objects.last().delete() to delete everything
> related to account.
> My project has many models related to account, and everything has log, is
> unfeasible be deleting the rows of each model to the end delete the account.
> Django needs to handle it.

Do you have any concrete suggestion what Django could do better in
this case?

So, to recap, what is happening here is that in the middle of an
attempt to delete object A, you are creating an object B referencing
object A, after a plan has been calculated (and partially executed)
that would otherwise successfully remove object A and everything
referencing it.

Have you considered altering the table for Log to include an ON DELETE
CASCADE clause instead? That would make the error go away without too
much effort, even though I still think the behavior you are
implementing is simply incorrect.

Cheers,

Michal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160426181740.GT435%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment