Opened 7 years ago

Closed 5 years ago

#12761 closed New feature (fixed)

Paraguayan local flavor

Reported by: dschulz Owned by: Bernhard Essl
Component: contrib.localflavor Version: master
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 7 years ago.
py local flavor
paraguayan_local_flavor.diff (6.5 KB) - added by Bernhard Essl 5 years ago.
paraguayan_local_flavor_2.diff (6.7 KB) - added by Bernhard Essl 5 years ago.

Download all attachments as: .zip

Change History (16)

Changed 7 years ago by dschulz

Attachment: py.tar.gz added

py local flavor

comment:1 Changed 7 years ago by dschulz

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 Changed 7 years ago by dschulz

Version: 1.1SVN

comment:3 Changed 7 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:4 Changed 6 years ago by anonymous

Triage Stage: AcceptedUnreviewed

comment:5 Changed 6 years ago by anonymous

Triage Stage: UnreviewedReady for checkin

comment:6 Changed 6 years ago by Russell Keith-Magee

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

Patch contains no tests.

comment:7 Changed 6 years ago by Russell Keith-Magee

Needs documentation: set

...or documentation.

comment:8 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: New feature

Changed 5 years ago by Bernhard Essl

comment:9 Changed 5 years ago by Bernhard Essl

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.

Changed 5 years ago by Bernhard Essl

comment:10 Changed 5 years ago by Bernhard Essl

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

comment:11 Changed 5 years ago by Jannis Leidel

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

comment:12 Changed 5 years ago by Bernhard Essl

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 Changed 5 years ago by Jannis Leidel

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