Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added full names and numerical codes for Swedish counties #117

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Commits on Sep 10, 2014

  1. Added dictionaries for numerical county codes and full county names.

    I have added the following dictionaries and functions to se_counties:
    
    NUMERICAL_COUNTY_CODES contains the numerical two-digit couty codes
    which has more or less replaced the alphabetical codes nowadays. Also,
    these numerical codes is always the leading digits in the codes for
    municipailites and smaller subdivisions, which can be beneficial.
    
    FULL_COUNTY_NAMES contains the full names of each county. The current
    labels given in SE_COUNTIES is good when it is obvioius to the user
    that he/she is selecting a county, but they are not identical to the
    full county name. Also, in Swedish the county names differ somewhat,
    e.g. "Skåne län" as opposed to the more generic "Stockholms län"
    (ending with genitive case s), which the Swedish i18n should honor.
    
    numerical_county_code() and full_county_name() are simply accessor
    methods for the above dictionaries, returning the corresponding values
    given a alphabetical county code.
    
    For backwards compatibility I have chosen to keep both the
    alphabetical codes and the shortened names (lacking the "county"-part)
    in the original SE_COUNTIES list, although I guess one could argue
    numerical codes and full names would be a better option.
    dessibelle committed Sep 10, 2014
    Configuration menu
    Copy the full SHA
    958c0fe View commit details
    Browse the repository at this point in the history
  2. Added @county_decorator() which adds a few accessor methods to models

    The decorator adds get_FIELDNAME_numerical_code() and
    get_FIELDNAME_full_name() methods to django models for all FIELDNAME
    values supplied in the field_names tuple. Ideally this can be used on
    all model fields that uses COUNTY_CHOICES for the choices argument.
    
    @county_decorator(field_names('field',))
    class MyClass:
        field = models.CharField(choices=se_counties=COUNTY_CHOICES)
    dessibelle committed Sep 10, 2014
    Configuration menu
    Copy the full SHA
    b222b24 View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2014

  1. Removed unused dependency.

    dessibelle committed Sep 11, 2014
    Configuration menu
    Copy the full SHA
    a15abc3 View commit details
    Browse the repository at this point in the history
  2. Formatting

    dessibelle committed Sep 11, 2014
    Configuration menu
    Copy the full SHA
    703a53f View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2014

  1. Removed class decorator and added SECountyField to handle model acces…

    …sors for full county name and numerical codes.
    
    Also renamed `FULL_COUNTY_NAMES` and `NUMERICAL_COUNTY_CODES` in `se_counties.py` into `NUMERICAL_COUNTY_CODE_CHOICES` and `FULL_COUNTY_NAME_CHOICES` respectively, as well as converted them both to tuple lists rather than dicts in order for them to be supplied as the `chocies` argument for the field.
    dessibelle committed Nov 21, 2014
    Configuration menu
    Copy the full SHA
    c4c4462 View commit details
    Browse the repository at this point in the history
  2. Syntax conformance.

    dessibelle committed Nov 21, 2014
    Configuration menu
    Copy the full SHA
    2bda725 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ca6bbb7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a7dff89 View commit details
    Browse the repository at this point in the history