1👍
It seems that you haven’t imported the datetime
constructor yet, also if you use it you will get a naive datetime, which will produce a warming because that structure doesn’t contain a tzinfo
object, so try using a Time Zone aware constructor for that datetime or use the make_aware
.
Check out this piece of documentation about the topic, and I’m sure you will solve it in the most proper way Timezones and utils
1👍
As the traceback shows, it’s not the method that is being treated as None
, but one of the functions that you call within it. I would guess that you have redefined either datetime
or Count
somewhere else in that module.
Also, this isn’t the problem, but note that you shouldn’t call now()
in the function definition: doing so fixes the default as of the time the process started, rather than getting a new value each time it is called. You should do this instead:
def getTotalMonthlyBackers(self, monthdate=None):
if monthdate is None:
monthdate = now()
- [Answered ]-Django reverse foreignkey is empty
- [Answered ]-Different content type objects in django template