stage._meta.get_all_related_objects()
You can get related models dynamically and check to see if there are
actually related instances for each of them.
Play with _meta in the shell and you'll find interesting and useful things.
Despite the underscore prefix, _meta is kept pretty stable and is used
often by normal users.
Shawn
I recommend (to any Django user) that you check out Marty Alchin's
"Pro Django."
Don't hesitate for a second because it was written in the ancient
times of Django 1.1 -- for Django to be changed enough that this book
becomes irrelevant it would take many years and drastic changes to the
internals of Django. This isn't a 'how-to' book like James Bennett's,
or a 'guide' like 'The Definitive Guide' by the BDFLs. It is a
serious, in-depth look that you don't need to use Django, but you want
to know to use Django effectively.
Shawn
And if you're lucky and running 1.3 version you have new option on on_delete
actions that can do it autogically.
--
Jani Tiainen