Skip to content

Default timezone in TimeZoneField isn't a valid timezone code #67

thomasgilgenast opened this Issue Mar 16, 2013 · 2 comments

3 participants


In account.models.Account, the language field has an appropriate default and then is handled again in create() to make sure that a newly created Account has a valid language. This is not the case for the timezone field. It is not touched in create(), and no default is provided in the field declaration. There is a default in the TimeZoneField class, but this default is just the empty string, which does not correspond to a valid timezone. Even in terms of database integrity, I was surprised to look at my database and see that my freshly created User had an Account with a non-null, non-blank field set to the empty string.

Either the TimeZoneField or the timezone field declaration in Account should specify a default that corresponds to a valid timezone.

@thomasgilgenast thomasgilgenast added a commit to thomasgilgenast/django-user-accounts that referenced this issue Mar 16, 2013
@thomasgilgenast thomasgilgenast added default timezone to TimeZoneField
The default is now settings.TIME_ZONE or 'UTC' since Unix installs
may opt to set setting.TIME_ZONE to None.

Fixes #67

My app raises an exception whenever a user that has not defined a timezone renders a timezone dependent template. It seems to me that the solution proposed by @thomasgilgenast fixes this problem, but I see that it hasn't been merged into the master branch.

I'm thinking about forking pinax/django-user-accounts and copy this solution into the fork, but first I would like to ask if there's a reason for this solution not being merged.

Pinax Project member
brosner commented Jan 14, 2014

I commented on thomasgilgenast@f044205 looking for clarification about why settings.TIME_ZONE would be None. Is anyone able to respond to that?

@ossanna16 ossanna16 changed the title from default timezone in TimeZoneField isn't a valid timezone code to Default timezone in TimeZoneField isn't a valid timezone code Dec 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.