diff --git a/django/contrib/localflavor/cz/forms.py b/django/contrib/localflavor/cz/forms.py index 699f395ad7..f3676b230b 100644 --- a/django/contrib/localflavor/cz/forms.py +++ b/django/contrib/localflavor/cz/forms.py @@ -50,7 +50,6 @@ class CZBirthNumberField(Field): """ default_error_messages = { 'invalid_format': _(u'Enter a birth number in the format XXXXXX/XXXX or XXXXXXXXXX.'), - 'invalid_gender': _(u'Invalid optional parameter Gender, valid values are \'f\' and \'m\''), 'invalid': _(u'Enter a valid birth number.'), } @@ -73,22 +72,10 @@ class CZBirthNumberField(Field): # Birth number is in format YYMMDD. Females have month value raised by 50. # In case that all possible number are already used (for given date), # the month field is raised by 20. - if gender is not None: - import warnings - warnings.warn( - "Support for validating the gender of a CZ Birth number has been deprecated.", - DeprecationWarning) - if gender == 'f': - female_const = 50 - elif gender == 'm': - female_const = 0 - else: - raise ValidationError(self.error_messages['invalid_gender']) - - month = int(birth[2:4]) - female_const - if (not 1 <= month <= 12): - if (not 1 <= (month - 20) <= 12): - raise ValidationError(self.error_messages['invalid']) + month = int(birth[2:4]) + if (not 1 <= month <= 12) and (not 21 <= month <= 32) and \ + (not 51 <= month <= 62) and (not 71 <= month <= 82): + raise ValidationError(self.error_messages['invalid']) day = int(birth[4:6]) if not (1 <= day <= 31): diff --git a/tests/regressiontests/localflavor/cz/tests.py b/tests/regressiontests/localflavor/cz/tests.py index becc02ba9c..b8b46b34bb 100644 --- a/tests/regressiontests/localflavor/cz/tests.py +++ b/tests/regressiontests/localflavor/cz/tests.py @@ -1,5 +1,3 @@ -import warnings - from django.contrib.localflavor.cz.forms import (CZPostalCodeField, CZRegionSelect, CZBirthNumberField, CZICNumberField) @@ -8,17 +6,6 @@ from django.test import SimpleTestCase class CZLocalFlavorTests(SimpleTestCase): - def setUp(self): - self.save_warnings_state() - warnings.filterwarnings( - "ignore", - category=DeprecationWarning, - module='django.contrib.localflavor.cz.forms' - ) - - def tearDown(self): - self.restore_warnings_state() - def test_CZRegionSelect(self): f = CZRegionSelect() out = u'''