From 44e407b7c6fbcd85307c6723ccd6fdd34946f821 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 8 Aug 2008 15:34:02 +0000 Subject: Fixed #7575 -- Peru now has regions, not departments (changed at some pointi n the last year or so). Thanks andresj and programmerq. This is backwards incompatible if you're using the Peruvian localflavor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8230 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/localflavor/pe/forms.py | 8 +++--- django/contrib/localflavor/pe/pe_department.py | 35 -------------------------- django/contrib/localflavor/pe/pe_region.py | 35 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 django/contrib/localflavor/pe/pe_department.py create mode 100644 django/contrib/localflavor/pe/pe_region.py diff --git a/django/contrib/localflavor/pe/forms.py b/django/contrib/localflavor/pe/forms.py index d192295dcf..d83a2225be 100644 --- a/django/contrib/localflavor/pe/forms.py +++ b/django/contrib/localflavor/pe/forms.py @@ -7,13 +7,13 @@ from django.forms import ValidationError from django.forms.fields import RegexField, CharField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ -class PEDepartmentSelect(Select): +class PERegionSelect(Select): """ - A Select widget that uses a list of Peruvian Departments as its choices. + A Select widget that uses a list of Peruvian Regions as its choices. """ def __init__(self, attrs=None): - from pe_department import DEPARTMENT_CHOICES - super(PEDepartmentSelect, self).__init__(attrs, choices=DEPARTMENT_CHOICES) + from pe_region import REGION_CHOICES + super(PERegionSelect, self).__init__(attrs, choices=REGION_CHOICES) class PEDNIField(CharField): """ diff --git a/django/contrib/localflavor/pe/pe_department.py b/django/contrib/localflavor/pe/pe_department.py deleted file mode 100644 index d7fa65f9cb..0000000000 --- a/django/contrib/localflavor/pe/pe_department.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -""" -A list of Peru departaments as `choices` in a -formfield. - -This exists in this standalone file so that it's only imported into memory -when explicitly needed. -""" - -DEPARTMENT_CHOICES = ( - ('AMA', u'Amazonas'), - ('ANC', u'Ancash'), - ('APU', u'Apurímac'), - ('ARE', u'Arequipa'), - ('AYA', u'Ayacucho'), - ('CAJ', u'Cajamarca'), - ('CUS', u'Cusco'), - ('HUV', u'Huancavelica'), - ('HUC', u'Huánuco'), - ('ICA', u'Ica'), - ('JUN', u'Junín'), - ('LAL', u'La Libertad'), - ('LAM', u'Lambayeque'), - ('LIM', u'Lima'), - ('LOR', u'Loreto'), - ('MDD', u'Madre de Dios'), - ('MOQ', u'Moquegua'), - ('PAS', u'Pasco'), - ('PIU', u'Piura'), - ('PUN', u'Puno'), - ('SAM', u'San Martín'), - ('TAC', u'Tacna'), - ('TUM', u'Tumbes'), - ('UCA', u'Ucayali'), -) diff --git a/django/contrib/localflavor/pe/pe_region.py b/django/contrib/localflavor/pe/pe_region.py new file mode 100644 index 0000000000..9863bd3d15 --- /dev/null +++ b/django/contrib/localflavor/pe/pe_region.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +""" +A list of Peru regions as `choices` in a formfield. + +This exists in this standalone file so that it's only imported into memory +when explicitly needed. +""" + +REGION_CHOICES = ( + ('AMA', u'Amazonas'), + ('ANC', u'Ancash'), + ('APU', u'Apurímac'), + ('ARE', u'Arequipa'), + ('AYA', u'Ayacucho'), + ('CAJ', u'Cajamarca'), + ('CAL', u'Callao'), + ('CUS', u'Cusco'), + ('HUV', u'Huancavelica'), + ('HUC', u'Huánuco'), + ('ICA', u'Ica'), + ('JUN', u'Junín'), + ('LAL', u'La Libertad'), + ('LAM', u'Lambayeque'), + ('LIM', u'Lima'), + ('LOR', u'Loreto'), + ('MDD', u'Madre de Dios'), + ('MOQ', u'Moquegua'), + ('PAS', u'Pasco'), + ('PIU', u'Piura'), + ('PUN', u'Puno'), + ('SAM', u'San Martín'), + ('TAC', u'Tacna'), + ('TUM', u'Tumbes'), + ('UCA', u'Ucayali'), +) -- cgit v1.3