I following django offical tutorials i don't know meaning of this function:
class Question(models.Model):
# ...
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
It will return TRUE
if pub_date is > this time - 1 Day
Why TRUE is consider to recently objects? Why it return recently published Questions Objects?
What is meaning of datetime.timedelta(days=1)
and also timezone.now() - datetime.timedelta(days=1)
Thanks.
Aucun commentaire:
Enregistrer un commentaire