Re: RuntimeWarning "DateTimeField received a naive datetime" with TIMESTAMP MySQL field
Yes I'm aware of this, however I'm not generating the datetime objects, it's all coming from Django (hence me wondering whether or not it's a bug or not). All I need to do to replicate the bug is get the object from the db and then save is straight away; then warning appears.
Django abstracts away the difference between MySQL's datetime field and timestamp field, so it should work!
On Friday, 16 November 2012 17:31:44 UTC, Timster wrote:
It's well-documented. Check out the Django documentation page on time zones:--When time zone support is enabled, Django uses time-zone-aware datetime objects. If your code creates datetime objects, they should be aware too. In this mode, the example above becomes:
import datetime from django.utils.timezone import utc now = datetime.datetime.utcnow().replace (tzinfo=utc)
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ai0Xql4hyGgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home