A ------> B
When B is deleted I want to save the As that are pointing at B by
repointing them at a different B if possible. To do this I have a
pre_delete signal registered for B models. Unfortunately does doesn't
work.
Django follows the relationship from B to A, and deletes the As before
signaling the pre_delete event for B. So, and event that could save
the As happens too late.
Now, I could use a pre_delete for A, but then I won't know that the A
is about to be deleted as a direct result of B being deleted, so I
can't possibly tell that B is about to go away, so I should move the
pointer to B to another B. This could simply be an admin directly
deleting an A.
So, signals fail me here, do they not? The only way to do this is to
override the delete method in B and take action there instead. I'd
prefer to avoid that by using signals.
Mike
I believe that this question was asked on this group a long time ago,
and the answer was that pre_delete signal was fired *before* actual
deletion occured,
but *after* objects were collected for deletion (i.e. after list of
objects that were to be deleted
was created - you can think of this list as of "deletion tree" show in
Django admin).
Writing this, I don't know if you've observed the same problem.
--
Tomasz Zielinski
http://pyconsultant.eu