This attribute is read in JavaScript with getAttribute() and checked on
!== undefined to determine if it is set:
https://github.com/django/django/commit/8eeb566aca33600d272dee5fba59c3445b5b8163
#diff-cb2d960617da7bad9ba5ed3366931159R22
This worked with the previous code, but getAttribute() returns null or "",
which never equals undefined. Because of this the following code will run,
calculating false offsets between browser time and server time, causing
false warnings to appear in the admin date widgets.
More info on getAttribute():
https://developer.mozilla.org/de/docs/Web/API/Element/getAttribute#Notes
I noticed this after upgrading to Django 1.9 while using django-suit,
which is missing the attribute on body at the moment:
https://github.com/darklow/django-suit/issues/449
--
Ticket URL: <https://code.djangoproject.com/ticket/25845>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Yes, this is documented as a backwards incompatible change in the release
notes. I think django-suit needs to add support for Django 1.9 by adding
the missing body attribute unless someone has an alternate suggestion.
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:1>
Comment (by Strayer):
But wasn't the old behavior to not show the warnings if the JavaScript
attribute is missing? As far as I can see, django-suit also didn't set the
window property !__admin_utc_offset!__ before. The warnings were not
shown, since the JS function addTimezoneWarning() won't do anything if
timezoneOffset is not set. The whole check on undefined doesn't make sense
to me and looks like a leftover of the previous code.
If the checks were to be replaced by a check on null (and possibly ""), it
would behave like before.
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:2>
* stage: Unreviewed => Accepted
Comment:
Thanks for clarifying -- thank makes sense. Care to submit a patch?
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:3>
Comment (by emre):
PR provided on github:
https://github.com/django/django/pull/5769
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:4>
Comment (by Strayer):
I already have the bug itself fixed, but I also want to add tests for
this, as suggested. Since I have some trouble getting the Django tests to
run I will hopefully be able to provide a PR with the fix and tests
tomorrow.
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:5>
* owner: nobody => Strayer
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:6>
Comment (by Strayer):
Sorry it took so long... had to figure out how the Selenium tests are done
in Django.
PR is open on Github:
https://github.com/django/django/pull/5782
I also signed and submitted the CLA just now.
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"9af40f5df13801ffadcc5ded7440e4616123959f" 9af40f5d]:
{{{
#!CommitTicketReference repository=""
revision="9af40f5df13801ffadcc5ded7440e4616123959f"
Fixed #25845 -- Fixed incorrect timezone warnings in custom admin
templates.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"badeb56f833138fe637607fe3c7e4bfae3048e50" badeb56]:
{{{
#!CommitTicketReference repository=""
revision="badeb56f833138fe637607fe3c7e4bfae3048e50"
[1.9.x] Fixed #25845 -- Fixed incorrect timezone warnings in custom admin
templates.
Backport of 9af40f5df13801ffadcc5ded7440e4616123959f from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25845#comment:9>