From a538dc8792b25af3a038cfc46bc5578bc60b6fd5 Mon Sep 17 00:00:00 2001 From: Simon Fransson Date: Fri, 21 Nov 2014 17:54:12 +0100 Subject: [PATCH] Better defaults for SECountyField. --- localflavor/se/models.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/localflavor/se/models.py b/localflavor/se/models.py index 2b732e646..587f4b404 100644 --- a/localflavor/se/models.py +++ b/localflavor/se/models.py @@ -42,13 +42,13 @@ class MyModel(models.Model): def __init__(self, *args, **kwargs): - if 'choices' not in kwargs: - kwargs['choices'] = COUNTY_CHOICES + defaults = { + 'max_digits': 2, + 'choices': COUNTY_CHOICES, + } + defaults.update(kwargs) - if 'max_length' not in kwargs: - kwargs['max_length'] = 2 - - super(SECountyField, self).__init__(*args, **kwargs) + super(SECountyField, self).__init__(*args, **defaults) def contribute_to_class(self, cls, name): if not cls._meta.abstract: