I am having trouble understanding functions that use:
time = timezone.now() - datetime.timedelta(days=30)
Firstly the timezone.now() gives the time that is set in Django … now the datetime.timedelta(days=30)
…
does it use the internal settings in django as set setting.py or another.
Secondly if so … should: the variable time not be 30days behind the current timezone.now();
In the function below
def test_was_published_recently_with_old_question(self):
"""
was_published_recently() should return False for questions whose
pub_date is older than 1 day.
"""
time = timezone.now() - datetime.timedelta(days=30)
old_question = Question(pub_date=time)
self.assertEqual(old_question.was_published_recently(), False)
how does this produce 1 day older … I think my issue is not understanding
time = timezone.now() - datetime.timedelta(days=30)
in its entirely
I would really appreciate the help. I am new to python and med level programmer … but haven't worked much with time.