Opened 16 years ago
Closed 14 years ago
#12761 closed New feature (fixed)
Paraguayan local flavor
| Reported by: | dschulz | Owned by: | Bernhard Essl |
|---|---|---|---|
| Component: | contrib.localflavor | Version: | dev |
| Severity: | Normal | Keywords: | local flavor paraguay |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Attached is basic local flavor support for Paraguay (PY).
Includes form helpers and department list.
Attachments (3)
Change History (16)
by , 16 years ago
comment:1 by , 16 years ago
Tarball contents follows:
py_departments.py:
# -*- coding: utf-8 -*-
"""
Paraguayan departments ready to use as choices in ChoiceFields.
Source: http://www.opaci.org.py/index.php?option=com_wrapper&Itemid=32
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
DEPARTMENT_CHOICES = (
('A', u'Concepción'),
('B', u'San Pedro'),
('C', u'Cordillera'),
('D', u'Guairá'),
('E', u'Caaguazú'),
('F', u'Caazapá'),
('G', u'Itapúa'),
('H', u'Misiones'),
('I', u'Paraguarí'),
('J', u'Alto Paraná'),
('K', u'Central'),
('L', u'Ñeembucú'),
('M', u'Amambay'),
('N', u'Canindeyú'),
('O', u'Pdte. Hayes'),
('P', u'Alto Paraguay'),
('Q', u'Boquerón'),
)
DEPARTMENT_ROMAN_CHOICES = (
('A', u'I Concepción'),
('B', u'II San Pedro'),
('C', u'III Cordillera'),
('D', u'IV Guairá'),
('E', u'V Caaguazú'),
('F', u'VI Caazapá'),
('G', u'VII Itapúa'),
('H', u'VIII Misiones'),
('I', u'IX Paraguarí'),
('J', u'X Alto Paraná'),
('K', u'XI Central'),
('L', u'XII Ñeembucú'),
('M', u'XIII Amambay'),
('N', u'XIV Canindeyú'),
('O', u'XV Pdte. Hayes'),
('P', u'XVI Alto Paraguay'),
('Q', u'XVII Boquerón'),
)
forms.py:
# -*- coding: utf-8 -*-
"""
PY-specific Form helpers.
"""
from django.forms import ValidationError
from django.forms.fields import RegexField, CharField, Select, EMPTY_VALUES
#from django.utils.encoding import smart_unicode
#from django.utils.translation import ugettext_lazy as _
class PyDepartmentSelect(Select):
"""
A Select widget with a list of Paraguayan departments as choices.
"""
def __init__(self, attrs=None):
from py_departments import DEPARTMENT_CHOICES
super(PyDepartmentSelect, self).__init__(attrs, choices=DEPARTMENT_CHOICES)
class PyNumeratedDepartmentSelect(Select):
"""
A Select widget with a roman numerated list of Paraguayan departments as choices.
"""
def __init__(self, attrs=None):
from py_departments import DEPARTMENT_ROMAN_CHOICES
super(PyNumeratedDepartmentSelect, self).__init__(attrs, choices=DEPARTMENT_ROMAN_CHOICES)
comment:2 by , 16 years ago
| Version: | 1.1 → SVN |
|---|
comment:3 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:4 by , 15 years ago
| Triage Stage: | Accepted → Unreviewed |
|---|
comment:5 by , 15 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:6 by , 15 years ago
| Has patch: | set |
|---|---|
| Needs tests: | set |
| Triage Stage: | Ready for checkin → Accepted |
Patch contains no tests.
comment:8 by , 14 years ago
| Severity: | → Normal |
|---|---|
| Type: | → New feature |
by , 14 years ago
| Attachment: | paraguayan_local_flavor.diff added |
|---|
comment:9 by , 14 years ago
| Easy pickings: | unset |
|---|---|
| Needs documentation: | unset |
| Needs tests: | unset |
| Owner: | changed from to |
| Status: | new → assigned |
| UI/UX: | unset |
I wrote a patch from the tar and also added tests and documentation.
by , 14 years ago
| Attachment: | paraguayan_local_flavor_2.diff added |
|---|
comment:10 by , 14 years ago
patch update; now it has Asunción in the departments list and better key names.
comment:11 by , 14 years ago
Something I forgot to ask specifically, what's the purpose of DEPARTMENT_ROMAN_CHOICES?
comment:12 by , 14 years ago
http://www.statoids.com/upy.html says: "Within Paraguay, the departments are referred to by numbers (usually expressed as Roman numerals or ordinals) which are the same as their ISO codes, except that Boquerón is number 17."
py local flavor