Opened 5 years ago

Closed 4 years ago

#12761 closed New feature (fixed)

Paraguayan local flavor

Reported by: dschulz Owned by: BernhardEssl
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 5 years ago.
py local flavor
paraguayan_local_flavor.diff (6.5 KB) - added by BernhardEssl 4 years ago.
paraguayan_local_flavor_2.diff (6.7 KB) - added by BernhardEssl 4 years ago.

Download all attachments as: .zip

Change History (16)

Changed 5 years ago by dschulz

py local flavor

comment:1 Changed 5 years ago by dschulz

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

  • Version changed from 1.1 to SVN

comment:3 Changed 5 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by anonymous

  • Triage Stage changed from Accepted to Unreviewed

comment:5 Changed 5 years ago by anonymous

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:6 Changed 5 years ago by russellm

  • Has patch set
  • Needs tests set
  • Triage Stage changed from Ready for checkin to Accepted

Patch contains no tests.

comment:7 Changed 5 years ago by russellm

  • Needs documentation set

...or documentation.

comment:8 Changed 4 years ago by julien

  • Severity set to Normal
  • Type set to New feature

Changed 4 years ago by BernhardEssl

comment:9 Changed 4 years ago by BernhardEssl

  • Easy pickings unset
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to BernhardEssl
  • Status changed from new to assigned
  • UI/UX unset

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

Changed 4 years ago by BernhardEssl

comment:10 Changed 4 years ago by BernhardEssl

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

comment:11 Changed 4 years ago by jezdez

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

comment:12 Changed 4 years ago by BernhardEssl

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 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

In [16477]:

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

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