Skip to content

Commit a7dff89

Browse files
committed
Better defaults for SECountyField.
1 parent ca6bbb7 commit a7dff89

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

localflavor/se/models.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class MyModel(models.Model):
4242

4343
def __init__(self, *args, **kwargs):
4444

45-
if 'choices' not in kwargs:
46-
kwargs['choices'] = COUNTY_CHOICES
45+
defaults = {
46+
'max_length': 2,
47+
'choices': COUNTY_CHOICES,
48+
}
49+
defaults.update(kwargs)
4750

48-
if 'max_length' not in kwargs:
49-
kwargs['max_length'] = 2
50-
51-
super(SECountyField, self).__init__(*args, **kwargs)
51+
super(SECountyField, self).__init__(*args, **defaults)
5252

5353
def contribute_to_class(self, cls, name):
5454
if not cls._meta.abstract:

0 commit comments

Comments
 (0)