3👍
✅
It’s TimeField
, as you said. Let’s have a look at TimeField docs: A time, represented in Python by a datetime.time instance
, so you shouldn’t use strptime on self.time
. I think that your code should looks like:
def late(self):
return self.time.hour > 9
Same for minute
0👍
You should not use tm_hour
and tm_min
but hour
and minute
respectively.
def late(self):
t = strptime(self.time, "%H:%M")
return t.hour > 9
- [Django]-Django CMS how to create nested plugins programatically
- [Django]-Group by in django
- [Django]-How to restrict access to pages based on user type in Django
Source:stackexchange.com