On Tue, Mar 6, 2012 at 12:21, Martin Ostrovsky
<[email protected]> wrote:
> Danny reading your reply gave me an idea to try and it worked.
>
> I switched the order of the inlines. So I put C first, then B. This way C
> validates properly, then B is deleted and the cascaded deletion deletes C
> and everything works as expected.

Good to hear! (and a jquery one-liner can swap the way they are displayed)

And reading this thread gave me an idea of a slightly cleaner workaround:
- either define FK as nullable or provide a "sentinel" FK object for
collecting "deletables"
- set the FK .ondelete to SET_NULL or SET with a callable that assigns
the sentinel
- in the FK object's post_delete() - need to doublecheck if that gets
called last as well -, clean out all the objects referencing
None/sentinel

But it's still just a workaround. It appears to me like deleting
dependent objects first would avoid the problem altogether (can't
think of negative side effects).

Cheers,
Danny

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to