Whoa. Spoke to soon on this one. Backing out the time zone info from MySQL allowed me to create a blog post and access the list in admin without the "Incorrect datetime value" error, but trying to change the publish_date field to an *earlier* date (a later date was ok.) produced:

"Database returned an invalid value in QuerySet.dates(). Are time zone definitions and pytz installed?"

Pytz was already installed and of course installing the time zone definitions simply gave "Incorrect datetime value" again when creating.

I even got "Incorrect datetime value" on creation with USE_TZ = False. I simply can't get this configuration to work:

Python 3.3.5
Django 1.6.5
MySQL Connector/Python 1.2.2 (Oracle's) with its mysql.connector.django backend
MySQL 5.5.37

I saw a similar report at http://stackoverflow.com/questions/21351251/database-returned-an-invalid-value-in-queryset-dates.

It was never resolved using MySQL - the poster switched to MariaDB 10. I've now switched to PostgreSQL 9.1.13 and it's working fine. It also solved the other problem I was having where bouncing the MySQL server required me to restart the web server.



On 27/06/14 23:15, cercatrova2 wrote:
On 27/06/14 23:01, cercatrova2 wrote:

I'm getting this error when I save a blog post in admin (it does in fact seem to get saved to the db) and when I try to access the blog post list.

Interestingly I'm getting this error at the same line as the poster of "global name 'pytz' is not defined" a short while ago. Both seem to be timezone related. I have USE_TZ set to True, TIME_ZONE set to "Europe/Amsterdam" (the same as the host time zone), and time zones imported into MySQL.



DatabaseError at /admin/blog/blogpost/

Incorrect datetime value: '%Y-%m-%d 00:00:00'

Error during template rendering

In template /usr/local/lib/python3.3/dist-packages/grappelli_safe/templates/admin/change_list.html, error at line 140

Incorrect datetime value: '%Y-%m-%d 00:00:00'



Solved by backing out the import of the time zones into MySQL. The datetimes on the blog posts are nevertheless getting saved in UTC so contrary to the Django doc the time zone info in MySQL doesn't seem to be necessary.





--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to