Skip to content

Commit

Permalink
Allow setting to None.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgoldenichec committed Jul 19, 2010
1 parent 0ccee7e commit 33398b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions timezones/fields.py
Expand Up @@ -122,6 +122,9 @@ def get_dtz_field(instance):
return getattr(instance, dt_field_name)

def set_dtz_field(instance, dt):
if dt is None: # Allow None here (db will catch later for null=False)
setattr(instance, dt_field_name, None)
return
if dt.tzinfo is None:
dt = default_tz.localize(dt)
time_zone = field.timezone
Expand Down

0 comments on commit 33398b1

Please sign in to comment.