Re: deletion of "distant" related objects

2009-04-12 Thread Margie
> For a model such as Book, you could iterate through > Book._meta.get_all_field_names(), call Book._meta.get_field_by_name() > for each name and look at the "direct" component of the returned result > to see which are the reverse relations. Those are then the things > pointing to your model.

Re: deletion of "distant" related objects

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 00:40 -0700, Margie wrote: [...] > Let's say that my Publisher and Book classes are in one app, and that > app doesn't know anything about the readers. Is there any simple way > to find all related object fields that point to book and clear them > out, without having to

Re: deletion of "distant" related objects

2009-04-12 Thread Margie
I see. So then I think what you are saying is that if I want to avoid these "readers" getting deleted, prior to deleting my publisher I need to find all readers of the books publised by that publisher, and clear them out so that they are no longer readers of those books. Let's say that my

Re: deletion of "distant" related objects

2009-04-12 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 23:29 -0700, Margie wrote: > I am having some trouble with the deletion of related objects that are > multiple levels away from the object being deleted. I've read a bunch > of stuff written on deletion of related objects, but nothing on this > particular problem - hoping

deletion of "distant" related objects

2009-04-12 Thread Margie
I am having some trouble with the deletion of related objects that are multiple levels away from the object being deleted. I've read a bunch of stuff written on deletion of related objects, but nothing on this particular problem - hoping someone can help. Say I have a model like this: class