#10443: Updating Timezone Aware DateTimeField Fails ---------------------------------------------------+------------------------ Reporter: simonb | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: SVN Resolution: | Keywords: Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 1 Needs_better_patch: 1 | ---------------------------------------------------+------------------------ Comment (by simonb):
Yes. It really does only happen with updates. I'll attach an example project which demonstrates the issue. The traceback is shown below. The example uses pytz http://pytz.sourceforge.net/ which greatly takes the tedium out of tz aware applications. Traceback (most recent call last): File "test.py", line 12, in <module> sctz.save() File "/Users/simonb/src/dj/bugs/savebug/bug/models.py", line 33, in save super(SomeClassTZ, self).save(force_insert=force_insert, force_update=force_update) File "/Users/simonb/src/dj/versions/trunk/django/db/models/base.py", line 329, in save self.save_base(force_insert=force_insert, force_update=force_update) File "/Users/simonb/src/dj/versions/trunk/django/db/models/base.py", line 380, in save_base rows = manager.filter(pk=pk_val)._update(values) File "/Users/simonb/src/dj/versions/trunk/django/db/models/query.py", line 466, in _update query.add_update_fields(values) File "/Users/simonb/src/dj/versions/trunk/django/db/models/sql/subqueries.py", line 245, in add_update_fields val = field.get_db_prep_save(val) File "/Users/simonb/src/dj/versions/trunk/django/db/models/fields/__init__.py", line 192, in get_db_prep_save return self.get_db_prep_value(value) File "/Users/simonb/src/dj/versions/trunk/django/db/models/fields/__init__.py", line 562, in get_db_prep_value return connection.ops.value_to_db_datetime(self.to_python(value)) File "/Users/simonb/src/dj/versions/trunk/django/db/models/fields/__init__.py", line 540, in to_python _('Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.')) django.core.exceptions.ValidationError: Enter a valid date/time in YYYY- MM-DD HH:MM[:ss[.uuuuuu]] format. -- Ticket URL: <http://code.djangoproject.com/ticket/10443#comment:3> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---