Chris,

I know this doesn't answer the hard part of your question, but here's  
a simple way I delete old stuff from a database via an external script  
that's run by cron:

Item.objects.filter(date_updated__lte = datetime.now() - timedelta 
(days = 30)).delete()

If you use timedelta, you can easily identify records that are too  
old. As for your complicated references, assuming you don't have  
cascading deletes happening automatically, you may have to do an  
objects.filter(), get the results, and iterate through those, deleting  
their dependencies before deleting them. That may be several levels  
deep. In any case, make sure you back up your database regularly in  
case of a mistake, and don't forget to add unit testing with robust  
fixtures to develop and test this purge feature.

Shawn



--~--~---------~--~----~------------~-------~--~----~
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