1👍
✅
DateTimeField
s expect a Python datetime
object, not a string. Use strptime
to convert your string into a datetime
.
The hasattr
call is almost certainly wrong, too. If you want to see if published
is in your data
dictionary, use if 'published' in data:
Source:stackexchange.com