File tree 2 files changed +2
-14
lines changed
2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,6 @@ class TimeZoneField(models.CharField):
15
15
None # if blank == True
16
16
pytz.tzinfo.DstTzInfo # an instance of
17
17
18
- The 'null' kwarg is tied directly to 'blank'.
19
- If you accept blanks, they will be stored in the DB as null's.
20
- If you don't accept blanks, the db will be statically typed
21
- with NOT NULL.
22
-
23
18
If you choose to add validators at runtime, they need to accept
24
19
pytz.tzinfo objects as input.
25
20
"""
@@ -31,17 +26,10 @@ class TimeZoneField(models.CharField):
31
26
CHOICES = tuple (zip (pytz .all_timezones , pytz .all_timezones ))
32
27
MAX_LENGTH = 63
33
28
34
- def __init__ (self , blank = False , validators = [], ** kwargs ):
35
- # We're not storing strings, we're storing objects.
36
- # Tie blank and DB null's together directly.
37
- if 'null' in kwargs :
38
- raise TypeError ("'null' is an invalid keyword argument" )
39
-
29
+ def __init__ (self , validators = [], ** kwargs ):
40
30
defaults = {
41
31
'max_length' : TimeZoneField .MAX_LENGTH ,
42
32
'choices' : TimeZoneField .CHOICES ,
43
- 'blank' : blank ,
44
- 'null' : blank ,
45
33
}
46
34
defaults .update (kwargs )
47
35
Original file line number Diff line number Diff line change 15
15
16
16
class TestModel (models .Model ):
17
17
tz_not_blank = TimeZoneField ()
18
- tz_blank = TimeZoneField (blank = True )
18
+ tz_blank = TimeZoneField (blank = True , null = True )
19
19
20
20
21
21
class TestModelForm (forms .ModelForm ):
You can’t perform that action at this time.
0 commit comments