Added support for South to introspect TimeZoneField #13

Open
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+15 −0
Split
View
@@ -155,3 +155,18 @@ def set_dtz_field(instance, dt):
## RED_FLAG: need to add a check at manage.py validation time that
## time_zone value is a valid query keyword (if it is one)
signals.class_prepared.connect(prep_localized_datetime)
+
+
+# allow South to handle TimeZoneField smoothly
+try:
+ from south.modelsinspector import add_introspection_rules
+ add_introspection_rules(rules=[(
+ (TimeZoneField, ), # Class(es) these apply to
+ [], # Positional arguments (not used)
+ { # Keyword argument
+ "max_length": ["max_length", { "default": MAX_TIMEZONE_LENGTH }],
+ }
+ )],
+ patterns=['timezones\.fields\.'])
+except ImportError:
+ pass