I want to calculate days difference between current date and previous date. i am trying this code
requiremntObj = CustomerLeads.objects.all()
a = datetime.datetime.now().date()
for i in requiremntObj:
date1=i.posting_date
diff = a-date1
print diff
I got a error unsupported operand type(s) for -: 'datetime.date' and 'unicode'
For current date i am getting datetime object and for date1 i am getting unicode.
posting_date = models.DateField()