#27544: F() Expressions updating dates in .update() field fails
-------------------------------------+-------------------------------------
Reporter: Gary Graham | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: F() | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):
* component: Uncategorized => Database layer (models, ORM)
Old description:
> Upon upgrading from 1.8 -> 1.10, I noticed that some code I had written
> now threw an error. Specifically, attempting to update datetime field's
> via F expression.
>
> Bisect log, about 3000 commits back -> https://dpaste.de/HGYb
>
> Branch with test showing regression ->
> https://github.com/tadgh/django/commit/c31133261c68b10525b8e3b34e6895a0c6ece4d0
>
> Apparent first commit where regression occurs ->
> https://github.com/django/django/pull/4601/commits/ed83881e648771d22658f21b939f66e75c499864
>
> Stacktrace from failure -> https://dpaste.de/DkSV
New description:
Upon upgrading from 1.8 -> 1.10, I noticed that some code I had written
now threw an error. Specifically, attempting to update datetime field's
via F expression.
Branch with test showing regression ->
https://github.com/tadgh/django/commit/c31133261c68b10525b8e3b34e6895a0c6ece4d0
Bisected to ed83881e648771d22658f21b939f66e75c499864: Fixed #23820 --
Supported per-database time zone.
Stacktrace from failure:
{{{
======================================================================
ERROR: test_F_expression_fails (timezones.test_regression.ProveRegression)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tadgh/Projects/django/tests/timezones/test_regression.py",
line 22, in test_F_expression_fails
self.timestamp.refresh_from_db()
File "/home/tadgh/Projects/django/django/db/models/base.py", line 585,
in refresh_from_db
db_instance = db_instance_qs.get()
File "/home/tadgh/Projects/django/django/db/models/query.py", line 381,
in get
num = len(clone)
File "/home/tadgh/Projects/django/django/db/models/query.py", line 240,
in __len__
self._fetch_all()
File "/home/tadgh/Projects/django/django/db/models/query.py", line 1061,
in _fetch_all
self._result_cache = list(self.iterator())
File "/home/tadgh/Projects/django/django/db/models/query.py", line 68,
in __iter__
for row in compiler.results_iter(results):
File "/home/tadgh/Projects/django/django/db/models/sql/compiler.py",
line 806, in results_iter
row = self.apply_converters(row, converters)
File "/home/tadgh/Projects/django/django/db/models/sql/compiler.py",
line 790, in apply_converters
value = converter(value, expression, self.connection,
self.query.context)
File
"/home/tadgh/Projects/django/django/db/backends/sqlite3/operations.py",
line 159, in convert_datetimefield_value
value = timezone.make_aware(value, self.connection.timezone)
File "/home/tadgh/Projects/django/django/utils/timezone.py", line 364,
in make_aware
return timezone.localize(value, is_dst=is_dst)
File "/home/tadgh/.venvs/django_env/lib/python3.4/site-
packages/pytz/__init__.py", line 227, in localize
raise ValueError('Not naive datetime (tzinfo is already set)')
ValueError: Not naive datetime (tzinfo is already set)
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27544#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.a14c60269e126c47fcd74921488120a7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.