Already got it, it's: timedelta(seconds=1) In stead of:
datetime.timedelta(seconds=1) On 31 mei, 14:29, "K.Berkhout" <[email protected]> wrote: > Hmm, seems like the method always returns false, anybody knows what > goes wrong? > > On 31 mei, 12:29, "K.Berkhout" <[email protected]> wrote: > > > Thanks you very much for the solution, Damien! > > > On 30 mei, 22:11, Damien GOMBAULT <[email protected]> wrote: > > > > Write a method is_modified in your Post model. > > > You can use datetime.timedelta to compare dates. > > > > def is_modified(self): > > > second = datetime.timedelta(seconds=1) > > > delta = self.last_modified - self.created > > > return delta >= second > > > > Then use it in your template : > > > > {% if post.is_modified %} > > > {{ ... }} > > > {% endif %} --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

