Ticket #8013: localflavor-co_ec-3.diff

File localflavor-co_ec-3.diff, 10.0 KB (added by Bernhard Essl, 13 years ago)
  • docs/ref/contrib/localflavor.txt

     
    4444    * Canada_
    4545    * Chile_
    4646    * China_
     47    * Colombia_
    4748    * Croatia_
    4849    * Czech_
     50    * Ecuador_
    4951    * Finland_
    5052    * France_
    5153    * Germany_
     
    98100.. _Canada: `Canada (ca)`_
    99101.. _Chile: `Chile (cl)`_
    100102.. _China: `China (cn)`_
     103.. _Colombia: `Colombia (co)`_
    101104.. _Croatia: `Croatia (hr)`_
    102105.. _Czech: `Czech (cz)`_
     106.. _Ecuador: `Ecuador (ec)`_
    103107.. _Finland: `Finland (fi)`_
    104108.. _France: `France (fr)`_
    105109.. _Germany: `Germany (de)`_
     
    392396    Valid formats are like 1XXXXXXXXXX, where X is digit.
    393397    The second digit could only be 3, 5 and 8.
    394398
     399Colombia (``co``)
     400=================
     401
     402.. class:: co.forms.CoDepartmentSelect
     403
     404    A ``Select`` widget that uses a list of Colombian departments as its choices.
     405
    395406Croatia (``hr``)
    396407================
    397408
     
    479490
    480491    A ``Select`` widget that uses a list of Czech regions as its choices.
    481492
     493Ecuador (``ec``)
     494================
     495
     496.. class:: ec.forms.EcProvinceSelect
     497
     498    A ``Select`` widget that uses a list of Ecuatorian provinces as its choices.   
     499
    482500Finland (``fi``)
    483501================
    484502
  • tests/regressiontests/forms/tests/__init__.py

     
    2121    CHLocalFlavorTests,
    2222    CLLocalFlavorTests,
    2323    CNLocalFlavorTests,
     24    COLocalFlavorTests,
    2425    CZLocalFlavorTests,
    2526    DELocalFlavorTests,
     27    ECLocalFlavorTests,
    2628    ESLocalFlavorTests,
    2729    FILocalFlavorTests,
    2830    FRLocalFlavorTests,
  • tests/regressiontests/forms/localflavor/co.py

     
     1from django.contrib.localflavor.co.forms import CODepartmentSelect
     2
     3from utils import LocalFlavorTestCase
     4
     5class COLocalFlavorTests(LocalFlavorTestCase):
     6    def test_CODepartmentSelect(self):
     7        d = CODepartmentSelect()
     8        out = u'''<select name="department">
     9<option value="AMA">Amazonas</option>
     10<option value="ANT">Antioquia</option>
     11<option value="ARA">Arauca</option>
     12<option value="ATL">Atl\xe1ntico</option>
     13<option value="DC">Bogot\xe1</option>
     14<option value="BOL">Bol\xedvar</option>
     15<option value="BOY">Boyac\xe1</option>
     16<option value="CAL">Caldas</option>
     17<option value="CAQ">Caquet\xe1</option>
     18<option value="CAS">Casanare</option>
     19<option value="CAU">Cauca</option>
     20<option value="CES">Cesar</option>
     21<option value="COR" selected="selected">C\xf3rdoba</option>
     22<option value="CUN">Cundinamarca</option>
     23<option value="CHO">Choc\xf3</option>
     24<option value="GUA">Guain\xeda</option>
     25<option value="GUV">Guaviare</option>
     26<option value="HUI">Huila</option>
     27<option value="LAG">La Guajira</option>
     28<option value="MAG">Magdalena</option>
     29<option value="MET">Meta</option>
     30<option value="NAR">Nari\xf1o</option>
     31<option value="NSA">Norte De Santander</option>
     32<option value="PUT">Putumayo</option>
     33<option value="QUI">Quind\xedo</option>
     34<option value="RIS">Risaralda</option>
     35<option value="SAP">San Andr\xe9s, Providencia y Santa Catalina</option>
     36<option value="SAN">Santander</option>
     37<option value="SUC">Sucre</option>
     38<option value="TOL">Tolima</option>
     39<option value="VAC">Valle Del Cauca</option>
     40<option value="VAU">Vaup\xe9s</option>
     41<option value="VID">Vichada</option>
     42</select>'''
     43        self.assertEqual(d.render('department', 'COR'), out)
  • tests/regressiontests/forms/localflavor/ec.py

     
     1from django.contrib.localflavor.ec.forms import ECProvinceSelect
     2
     3from utils import LocalFlavorTestCase
     4
     5class ECLocalFlavorTests(LocalFlavorTestCase):
     6    def test_ECProvinceSelect(self):
     7        p = ECProvinceSelect()
     8        out = u'''<select name="province">
     9<option value="A">Azuay</option>
     10<option value="B">Bol\xedvar</option>
     11<option value="F">Ca\xf1ar</option>
     12<option value="C">Carchi</option>
     13<option value="X">Cotopaxi</option>
     14<option value="H">Chimborazo</option>
     15<option value="O">El Oro</option>
     16<option value="E">Esmeraldas</option>
     17<option value="W">Gal\xe1pagos</option>
     18<option value="G">Guayas</option>
     19<option value="I">Imbabura</option>
     20<option value="L">Loja</option>
     21<option value="R">Los R\xedos</option>
     22<option value="M">Manab\xed</option>
     23<option value="S">Morona Santiago</option>
     24<option value="N">Napo</option>
     25<option value="D">Orellana</option>
     26<option value="Y">Pastaza</option>
     27<option value="P">Pichincha</option>
     28<option value="SE">Santa Elena</option>
     29<option value="SD">Sto. Domingo De Los Ts\xe1chilas</option>
     30<option value="U" selected="selected">Sucumb\xedos</option>
     31<option value="T">Tungurahua</option>
     32<option value="Z">Zamora Chinchipe</option>
     33</select>'''
     34        self.assertEqual(p.render('province', 'U'), out)
  • tests/regressiontests/forms/localflavortests.py

     
    99from localflavor.cl import CLLocalFlavorTests
    1010from localflavor.cz import CZLocalFlavorTests
    1111from localflavor.cn import CNLocalFlavorTests
     12from localflavor.co import COLocalFlavorTests
    1213from localflavor.de import DELocalFlavorTests
    1314from localflavor.es import ESLocalFlavorTests
     15from localflavor.ec import ECLocalFlavorTests
    1416from localflavor.fi import FILocalFlavorTests
    1517from localflavor.fr import FRLocalFlavorTests
    1618from localflavor.gb import GBLocalFlavorTests
  • django/contrib/localflavor/ec/ec_provinces.py

     
     1# -*- coding: utf-8 -*-
     2"""
     3A list of Ecuador departaments as `choices` in a
     4formfield.
     5
     6This exists in this standalone file so that it's only
     7imported into memory when explicitly needed.
     8"""
     9
     10PROVINCE_CHOICES = (
     11    ('A',  u'Azuay'),
     12    ('B',  u'Bolívar'),
     13    ('F',  u'Cañar'),
     14    ('C',  u'Carchi'),
     15    ('X',  u'Cotopaxi'),
     16    ('H',  u'Chimborazo'),
     17    ('O',  u'El Oro'),
     18    ('E',  u'Esmeraldas'),
     19    ('W',  u'Galápagos'),
     20    ('G',  u'Guayas'),
     21    ('I',  u'Imbabura'),
     22    ('L',  u'Loja'),
     23    ('R',  u'Los Ríos'),
     24    ('M',  u'Manabí'),
     25    ('S',  u'Morona Santiago'),
     26    ('N',  u'Napo'),
     27    ('D',  u'Orellana'),
     28    ('Y',  u'Pastaza'),
     29    ('P',  u'Pichincha'),
     30    ('SE', u'Santa Elena'),
     31    ('SD', u'Sto. Domingo De Los Tsáchilas'),
     32    ('U',  u'Sucumbíos'),
     33    ('T',  u'Tungurahua'),
     34    ('Z',  u'Zamora Chinchipe'),
     35)
  • django/contrib/localflavor/ec/forms.py

     
     1"""
     2Ecuador-specific form helpers.
     3"""
     4
     5from django.forms.fields import Select
     6
     7class ECProvinceSelect(Select):
     8    """
     9    A Select widget that uses a list of Ecuador provinces as its choices.
     10    """
     11    def __init__(self, attrs=None):
     12        from ec_provinces import PROVINCE_CHOICES
     13        super(ECProvinceSelect, self).__init__(choices=PROVINCE_CHOICES)
  • django/contrib/localflavor/co/forms.py

     
     1"""
     2Colombian-specific form helpers.
     3"""
     4
     5from django.forms.fields import Select
     6
     7class CODepartmentSelect(Select):
     8    """
     9    A Select widget that uses a list of Colombian states as its choices.
     10    """
     11    def __init__(self, attrs=None):
     12        from co_departments import DEPARTMENT_CHOICES
     13        super(CODepartmentSelect, self).__init__(choices=DEPARTMENT_CHOICES)
  • django/contrib/localflavor/co/co_departments.py

     
     1# -*- coding: utf-8 -*-
     2"""
     3A list of Colombian departaments as `choices` in a
     4formfield.
     5
     6This exists in this standalone file so that it's only
     7imported into memory when explicitly needed.
     8"""
     9
     10DEPARTMENT_CHOICES = (
     11    ('AMA', u'Amazonas'),
     12    ('ANT', u'Antioquia'),
     13    ('ARA', u'Arauca'),
     14    ('ATL', u'Atlántico'),
     15    ('DC',  u'Bogotá'),
     16    ('BOL', u'Bolívar'),
     17    ('BOY', u'Boyacá'),
     18    ('CAL', u'Caldas'),
     19    ('CAQ', u'Caquetá'),
     20    ('CAS', u'Casanare'),
     21    ('CAU', u'Cauca'),
     22    ('CES', u'Cesar'),
     23    ('COR', u'Córdoba'),
     24    ('CUN', u'Cundinamarca'),
     25    ('CHO', u'Chocó'),
     26    ('GUA', u'Guainía'),
     27    ('GUV', u'Guaviare'),
     28    ('HUI', u'Huila'),
     29    ('LAG', u'La Guajira'),
     30    ('MAG', u'Magdalena'),
     31    ('MET', u'Meta'),
     32    ('NAR', u'Nariño'),
     33    ('NSA', u'Norte De Santander'),
     34    ('PUT', u'Putumayo'),
     35    ('QUI', u'Quindío'),
     36    ('RIS', u'Risaralda'),
     37    ('SAP', u'San Andrés, Providencia y Santa Catalina'),
     38    ('SAN', u'Santander'),
     39    ('SUC', u'Sucre'),
     40    ('TOL', u'Tolima'),
     41    ('VAC', u'Valle Del Cauca'),
     42    ('VAU', u'Vaupés'),
     43    ('VID', u'Vichada'),
     44)
Back to Top