I have a Donor table with lastAttendance
column. How can I subtract current day with selected lastAttendance date?
d0 = Donor.objects.only("lastAttendance")
d1 = datetime.now()
delta = d1 - d0
Error:
unsupported operand type(s) for -: 'datetime.datetime' and 'QuerySet'
There is a timesince function for Django. Read about it in the docs. https://docs.djangoproject.com/en/1.11/ref/templates/builtins/#timesince