Hi .. im wondering how to make some posted texts be deleted on some certain date/time on a django site. Is it done with scripts to delete content in the database?
+2
A:
Yes, this is what management commands are for. You start these usually with a cronjob.
Further information: http://docs.djangoproject.com/en/dev/howto/custom-management-commands/
mawimawi
2010-05-22 13:09:09
If you want to pass control of your cleanup tasks (or any cron-powered jobs), check out django-chronograph (http://github.com/t11e/django-chronograph) which lets you (or them) schedule and run django management tasks via the Admin. It's awesome
stevejalim
2010-05-22 15:31:06
+2
A:
I believe the most straightforward way to go about this is to hide the data to the clients. This is done by adding some expiration_date
field to the model. Then you may have a custom manager that looks like:
class ValidObject(Manager):
def filter_valid(self):
return self.filter(expiration_date__gt=datetime.date.today())
Olivier
2010-05-22 15:26:31