Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for multi-db in LocalizedDateTimeField.

  • Loading branch information...
commit 12172585a164d046411751931c0ecf43c4b78148 1 parent 2b903a3
@brosner authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 timezones/fields.py
View
8 timezones/fields.py
@@ -83,7 +83,7 @@ def formfield(self, **kwargs):
defaults.update(kwargs)
return super(LocalizedDateTimeField, self).formfield(**defaults)
- def get_db_prep_save(self, value):
+ def get_db_prep_save(self, value, connection=None):
"""
Returns field's value prepared for saving into a database.
"""
@@ -93,9 +93,9 @@ def get_db_prep_save(self, value):
value = default_tz.localize(value)
else:
value = value.astimezone(default_tz)
- return super(LocalizedDateTimeField, self).get_db_prep_save(value)
+ return super(LocalizedDateTimeField, self).get_db_prep_save(value, connection=connection)
- def get_db_prep_lookup(self, lookup_type, value):
+ def get_db_prep_lookup(self, lookup_type, value, connection=None, prepared=None):
"""
Returns field's value prepared for database lookup.
"""
@@ -104,7 +104,7 @@ def get_db_prep_lookup(self, lookup_type, value):
value = default_tz.localize(value)
else:
value = value.astimezone(default_tz)
- return super(LocalizedDateTimeField, self).get_db_prep_lookup(lookup_type, value)
+ return super(LocalizedDateTimeField, self).get_db_prep_lookup(lookup_type, value, connection=connection, prepared=prepared)
def prep_localized_datetime(sender, **kwargs):
Please sign in to comment.
Something went wrong with that request. Please try again.