You could write a management command https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/
and execute it regularly (for example using a cron job) On Sat, Nov 5, 2016 at 3:31 PM, YOGITHA A N <[email protected]> wrote: > So here are my models: > > * class Mess(models.Model):* > muser = models.OneToOneField(User) > MESS_NAME = (('GH','girls hostel top mess'), > ('IH','girls hostel down mess'), > ('MM','Mega mess'), > ('FB','First Block mess'), > ('SB','Second Block mess'), > ('TB','Third Block mess'), > ) > mess_name = models.CharField(max_length=25, choices = > MESS_NAME,primary_key=True) > per_day_cost = models.IntegerField() > def __str__(self): > return self.mess_name > > *class MessMenu(models.Model):* > mess_name = models.ForeignKey(Mess) > day = models.DateField() > morning = models.TextField() > afternoon = models.TextField() > snacks = models.TextField() > dinner = models.TextField() > def __str__(self): > return self.mess_name > > Once i create an object in MessMenu I want django to delete that object > after 7 days. Please let me know how to delete a certain object after a > given period of time. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/6dcf1a57-7a89-40e1-b6e7-fbd28e78c27d%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/6dcf1a57-7a89-40e1-b6e7-fbd28e78c27d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei2YNgLTuJG0Wus2ZyhLktpRY7zCdOhrFtm1QG6YmBU8gw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

