[Answer]-Saving datetime string to DateTimeField returns validation error

1👍

DateTimeFields 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:

Leave a comment