I'll admit that i'm a bit old-school and most people are going to cringe at seeing this,
I would set a DB trigger with the raw logic On Mon, Feb 4, 2013 at 2:14 AM, Mike Dewhirst <mi...@dewhirst.com.au> wrote: > This is the error ... Select a valid choice. That choice is not one of the > available choices. > > I want to delete a bunch of "child" records when a "parent" record is > deleted. While I'm using that terminology they are not actually related in > the usual sense. All however are in foreign key relationships with the same > owner/master. > > The child records all know which parents they have because the parent added > its mark to a field in the child when the child record got created and > linked to the master. In fact if that child had been added by another > parent, the next parent just adds its mark instead of adding another child. > > When a parent gets deleted from the master, its mark is removed from all the > child records it was involved with and if it was the only mark the child > gets deleted too. Or at least that is what I want to happen. > > My question is: > > In overview, how should I be doing this? > > At the moment I'm trying to do it all via model methods calling various > managers because it feels like the right place to do it. > > I have tried to make a custom manager with use_for_related_fields = True but > still get the same error. > > Thanks for any help > > Mike > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.