On Tue, Mar 6, 2012 at 12:06, Martin Ostrovsky <[email protected]> wrote: >[...] > Now I get what's happening (I think), B gets deleted first, then the formset > validation for C runs, tries to validate the drop down choice, and fails > since B has already been deleted. > > What do you guys think? Is this a bug or a really really small corner case > that most people will never stumble upon?
Just want to add that's not the only place where this can happen. If you hook into the post_delete() delete signal of a model with a FK, your method can't access the FK object if it's a cascaded delete invoked by the FK object's delete(). I always wondered why children don't get deleted first (which is how the database _has_ to do it anyway). My workaround is to delete in the correct order myself but I wish I didn't have to. 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.
