I have DateTimeField:
class Assignment (models.Model):
official_deadline = models.DateTimeField(null=True, blank=True)
I need to compare it with the current time, I tried:
def official_deadline_past(self):
if datetime.datetime.today() > self.official_deadline:
return True
return False
But he always comes back. FalseI also tried:
def official_deadline_past(self):
if datetime.datetime.now() > self.official_deadline:
return True
return False
But I have the same problem.
I have information in the field: 2011-07-02 00:00:00for example, in the form generatedModelForm
source
share