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 i开发者_高级运维n the database?
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/
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())
精彩评论