Opened 15 years ago

Closed 13 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)

py.tar.gz (1020 bytes ) - added by dschulz 15 years ago.
py local flavor
paraguayan_local_flavor.diff (6.5 KB ) - added by Bernhard Essl 13 years ago.
paraguayan_local_flavor_2.diff (6.7 KB ) - added by Bernhard Essl 13 years ago.

Download all attachments as: .zip

Change History (16)

by dschulz, 15 years ago

Attachment: py.tar.gz added

py local flavor

comment:1 by dschulz, 15 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 dschulz, 15 years ago

Version: 1.1SVN

comment:3 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:4 by anonymous, 14 years ago

Triage Stage: AcceptedUnreviewed

comment:5 by anonymous, 14 years ago

Triage Stage: UnreviewedReady for checkin

comment:6 by Russell Keith-Magee, 14 years ago

Has patch: set
Needs tests: set
Triage Stage: Ready for checkinAccepted

Patch contains no tests.

comment:7 by Russell Keith-Magee, 14 years ago

Needs documentation: set

...or documentation.

comment:8 by Julien Phalip, 13 years ago

Severity: Normal
Type: New feature

by Bernhard Essl, 13 years ago

comment:9 by Bernhard Essl, 13 years ago

Easy pickings: unset
Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Bernhard Essl
Status: newassigned
UI/UX: unset

I wrote a patch from the tar and also added tests and documentation.

by Bernhard Essl, 13 years ago

comment:10 by Bernhard Essl, 13 years ago

patch update; now it has Asunción in the departments list and better key names.

comment:11 by Jannis Leidel, 13 years ago

Something I forgot to ask specifically, what's the purpose of DEPARTMENT_ROMAN_CHOICES?

comment:12 by Bernhard Essl, 13 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."

comment:13 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: assignedclosed

In [16477]:

Fixed #12761 -- Added Paraguayan local flavor. Thanks, dschulz and BernhardEssl.

Note: See TracTickets for help on using tickets.
Back to Top