File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ class TimeZoneField(models.CharField):
18
18
__metaclass__ = models .SubfieldBase
19
19
20
20
CHOICES = tuple (zip (pytz .all_timezones , pytz .all_timezones ))
21
+ MAX_LENGTH = 63
21
22
22
23
def __init__ (self , validators = [], ** kwargs ):
23
24
defaults = {
24
- 'max_length' : 63 ,
25
+ 'max_length' : TimeZoneField . MAX_LENGTH ,
25
26
'choices' : TimeZoneField .CHOICES ,
26
27
}
27
28
defaults .update (kwargs )
@@ -75,3 +76,23 @@ def get_prep_value(self, value):
75
76
76
77
def value_to_string (self , value ):
77
78
return self .get_prep_value (value )
79
+
80
+
81
+ # South support
82
+ try :
83
+ from south .modelsinspector import add_introspection_rules
84
+ except ImportError :
85
+ pass
86
+ else :
87
+ add_introspection_rules (
88
+ rules = [(
89
+ (TimeZoneField , ), # Class(es) these apply to
90
+ [], # Positional arguments (not used)
91
+ { # Keyword argument
92
+ 'max_length' : [
93
+ 'max_length' , { 'default' : TimeZoneField .MAX_LENGTH }
94
+ ],
95
+ }
96
+ )],
97
+ patterns = ['timezones\.fields\.' ]
98
+ )
You can’t perform that action at this time.
0 commit comments