1👍
✅
The error clearly states that the days
parameter to timedelta()
is None
(it expects an int
). In your code, you only have one line where you are calling timedelta()
with a variable for days
:
rcustom = i.start_date.date() - datetime.timedelta(days= reminderx)
So all that means is that the variable reminderx
is None
. And if you look at your model definition, reminderx
can be null. You either need to make the model not accept nulls or have some default value when using the attribute:
reminderx = i.reminderx or 1 # one day if nothing is specified
rcustom = i.start_date.date() - datetime.timedelta(days= reminderx)
Source:stackexchange.com