Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

added default timezone to TimeZoneField on branch default-timezone #68

Open
wants to merge 1 commit into from

2 participants

@thomasgilgenast

The default is now settings.TIME_ZONE or 'UTC' since Unix installs may opt to set setting.TIME_ZONE to None.

Fixes #67

@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
f044205
@brosner
Owner

Are you saying that some distros change Django's default TIME_ZONE value to None?

Owner

I am otherwise in favor of adding a default, but just need to get some clarification on why we can't just set it to settings.TIME_ZONE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2013
  1. @thomasgilgenast

    added default timezone to TimeZoneField

    thomasgilgenast authored
    The default is now settings.TIME_ZONE or 'UTC' since Unix installs
    may opt to set setting.TIME_ZONE to None.
    
    Fixes #67
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 account/fields.py
View
5 account/fields.py
@@ -8,9 +8,12 @@ class TimeZoneField(models.CharField):
__metaclass__ = models.SubfieldBase
def __init__(self, *args, **kwargs):
+ default_tz = 'UTC'
+ if settings.TIME_ZONE:
+ default_tz = settings.TIME_ZONE
defaults = {
"max_length": 100,
- "default": "",
+ "default": default_tz,
"choices": settings.ACCOUNT_TIMEZONES,
"blank": True,
}
Something went wrong with that request. Please try again.