#19929: "USE_TZ = True" causes error
-----------------------------------+--------------------------------------
     Reporter:  tomas_00           |                    Owner:  aaugustin
         Type:  Bug                |                   Status:  assigned
    Component:  Uncategorized      |                  Version:  master
     Severity:  Normal             |               Resolution:
     Keywords:  datetime,timzone,  |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------

Comment (by aaugustin):

 `len` swallowed the useful portion of the traceback :(

 Here are my current conclusions:
 - Django explicitly excludes NULL values from `datetimes` queries; this
 behavior is tested; and anyway your field isn't nullable here.
 - For a reason I can't explain, the list of year values returned by the
 database contains `None`, which triggers this exception.

 I could paper over this problem by skipping `None` values, but that
 doesn't address the root cause, and the problem may resurface somewhere
 else.

 New theory: does MySQL knows about your timezone? In `./manage.py shell`,
 this will tell you the name of your current time zone:

 {{{
 >>> from django.utils import timezone
 >>> timezone.get_current_timezone_name()
 }}}

 Then, in `./manage.py dbshell`, run:

 {{{
 mysql> SELECT * from mysql.time_zone_name where Name = "<your current
 timezone name>";
 }}}

 Does this return a row?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19929#comment:6>
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to