diff --git a/django/contrib/localflavor/pe/forms.py b/django/contrib/localflavor/pe/forms.py
index d192295..3912ea8 100644
|
a
|
b
|
from django.forms import ValidationError
|
| 7 | 7 | from django.forms.fields import RegexField, CharField, Select, EMPTY_VALUES |
| 8 | 8 | from django.utils.translation import ugettext_lazy as _ |
| 9 | 9 | |
| 10 | | class PEDepartmentSelect(Select): |
| | 10 | class PERegionSelect(Select): |
| 11 | 11 | """ |
| 12 | | A Select widget that uses a list of Peruvian Departments as its choices. |
| | 12 | A Select widget that uses a list of Peruvian Regions as its choices. |
| 13 | 13 | """ |
| 14 | 14 | def __init__(self, attrs=None): |
| 15 | | from pe_department import DEPARTMENT_CHOICES |
| 16 | | super(PEDepartmentSelect, self).__init__(attrs, choices=DEPARTMENT_CHOICES) |
| | 15 | from pe_region import REGION_CHOICES |
| | 16 | super(PERegionSelect, self).__init__(attrs, choices=REGION_CHOICES) |
| | 17 | |
| | 18 | # TODO: Backwards-compatibility for legacy code. |
| | 19 | # PEDepartmentSelect ... |
| 17 | 20 | |
| 18 | 21 | class PEDNIField(CharField): |
| 19 | 22 | """ |
diff --git a/django/contrib/localflavor/pe/pe_department.py b/django/contrib/localflavor/pe/pe_department.py
deleted file mode 100644
index d7fa65f..0000000
|
+
|
-
|
|
| 1 | | # -*- coding: utf-8 -*- |
| 2 | | """ |
| 3 | | A list of Peru departaments as `choices` in a |
| 4 | | formfield. |
| 5 | | |
| 6 | | This exists in this standalone file so that it's only imported into memory |
| 7 | | when explicitly needed. |
| 8 | | """ |
| 9 | | |
| 10 | | DEPARTMENT_CHOICES = ( |
| 11 | | ('AMA', u'Amazonas'), |
| 12 | | ('ANC', u'Ancash'), |
| 13 | | ('APU', u'Apurímac'), |
| 14 | | ('ARE', u'Arequipa'), |
| 15 | | ('AYA', u'Ayacucho'), |
| 16 | | ('CAJ', u'Cajamarca'), |
| 17 | | ('CUS', u'Cusco'), |
| 18 | | ('HUV', u'Huancavelica'), |
| 19 | | ('HUC', u'Huánuco'), |
| 20 | | ('ICA', u'Ica'), |
| 21 | | ('JUN', u'Junín'), |
| 22 | | ('LAL', u'La Libertad'), |
| 23 | | ('LAM', u'Lambayeque'), |
| 24 | | ('LIM', u'Lima'), |
| 25 | | ('LOR', u'Loreto'), |
| 26 | | ('MDD', u'Madre de Dios'), |
| 27 | | ('MOQ', u'Moquegua'), |
| 28 | | ('PAS', u'Pasco'), |
| 29 | | ('PIU', u'Piura'), |
| 30 | | ('PUN', u'Puno'), |
| 31 | | ('SAM', u'San Martín'), |
| 32 | | ('TAC', u'Tacna'), |
| 33 | | ('TUM', u'Tumbes'), |
| 34 | | ('UCA', u'Ucayali'), |
| 35 | | ) |
diff --git a/django/contrib/localflavor/pe/pe_region.py b/django/contrib/localflavor/pe/pe_region.py
new file mode 100644
index 0000000..9863bd3
|
-
|
+
|
|
| | 1 | # -*- coding: utf-8 -*- |
| | 2 | """ |
| | 3 | A list of Peru regions as `choices` in a formfield. |
| | 4 | |
| | 5 | This exists in this standalone file so that it's only imported into memory |
| | 6 | when explicitly needed. |
| | 7 | """ |
| | 8 | |
| | 9 | REGION_CHOICES = ( |
| | 10 | ('AMA', u'Amazonas'), |
| | 11 | ('ANC', u'Ancash'), |
| | 12 | ('APU', u'Apurímac'), |
| | 13 | ('ARE', u'Arequipa'), |
| | 14 | ('AYA', u'Ayacucho'), |
| | 15 | ('CAJ', u'Cajamarca'), |
| | 16 | ('CAL', u'Callao'), |
| | 17 | ('CUS', u'Cusco'), |
| | 18 | ('HUV', u'Huancavelica'), |
| | 19 | ('HUC', u'Huánuco'), |
| | 20 | ('ICA', u'Ica'), |
| | 21 | ('JUN', u'Junín'), |
| | 22 | ('LAL', u'La Libertad'), |
| | 23 | ('LAM', u'Lambayeque'), |
| | 24 | ('LIM', u'Lima'), |
| | 25 | ('LOR', u'Loreto'), |
| | 26 | ('MDD', u'Madre de Dios'), |
| | 27 | ('MOQ', u'Moquegua'), |
| | 28 | ('PAS', u'Pasco'), |
| | 29 | ('PIU', u'Piura'), |
| | 30 | ('PUN', u'Puno'), |
| | 31 | ('SAM', u'San Martín'), |
| | 32 | ('TAC', u'Tacna'), |
| | 33 | ('TUM', u'Tumbes'), |
| | 34 | ('UCA', u'Ucayali'), |
| | 35 | ) |