Re: Check all foreign keys before delete.

2011-03-25 Thread Jani Tiainen
On Thursday 24 March 2011 20:46:12 pbzRPA wrote: > Hi, > > I am constantly running in a brick wall when it comes to deleting > records in Django. If you have one or two foreign keys it is easy to > check if they are in use, but once an application starts getting big > you can not remember which mo

Re: Check all foreign keys before delete.

2011-03-24 Thread pbzRPA
Great thanks, will definitely have a look. -- 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.c

Re: Check all foreign keys before delete.

2011-03-24 Thread Shawn Milochik
You're welcome. 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

Re: Check all foreign keys before delete.

2011-03-24 Thread pbzRPA
Hit the nail on the head :) Thank you very much for the quick response. Problem solved. -- 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 emai

Re: Check all foreign keys before delete.

2011-03-24 Thread Shawn Milochik
Once you have your 'stage' instance, try this: 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 underscor

Check all foreign keys before delete.

2011-03-24 Thread pbzRPA
Hi, I am constantly running in a brick wall when it comes to deleting records in Django. If you have one or two foreign keys it is easy to check if they are in use, but once an application starts getting big you can not remember which models are making use of a foreign key and if a specific foreig