How can i compare two datetimes in Django

Viewed 1730

I can`t compare two datetime variable. One of it is DateTimeField in my models.py

date_of_end_discount = models.DateTimeField()

Second is datetime.now. This is sample of code of compare

from datetime import datetime

def is_discount(self):
    return self.date_of_end_discount > datetime.now()

But i have TypeError:

can't compare offset-naive and offset-aware datetimes
1 Answers
Related