Hi,
here is the essence:

from django.contrib.admin.util NestedObjects
collector = NestedObjects(using=None)
collector.collect(User.objects.all())
to_delete = collector.nested()

It gives you a raw list of all the objects. For more friendly output
see the usage of NestedObjects.nested with the callback.

Best would be to have a look into admin sources: django\contrib\admin
\util.py

Cheers,
Waldek

On Jan 4, 5:37 pm, diafygi <diaf...@gmail.com> wrote:
> In the django admin site, it lists the entries that will be deleted
> via cascade if you want to delete something. I'm wondering if you can
> do something similar in the shell to identify the rows affected by a
> deletion.
>
> Is there such a function in django to show the list of casade deletes
> like in the admin? If not, what can I do to create that list?
>
> This would be very helpful if you accidentally deleted an entry that
> affected many rows (i.e. an auth User or something), so that you could
> identify the affected rows from a backup, then re-insert them into the
> database.
>
> Thanks,
> Daniel

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

Reply via email to