SmileyChris / django-countries

A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Home Page:https://pypi.python.org/pypi/django-countries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When setting `COUNTRIES_OVERRIDE`, allow custom flag_url

kunambi opened this issue · comments

Because of Django compability issues in django-modeltranslation, the Indonesian language has the code ind rather than id. In order for our project to mesh well with django-countries we're using COUNTRIES_OVERRIDE like so:

COUNTRIES_OVERRIDE = {
    "ID": None,
    "IND": {
        "names": [
            _("Indonesia"),
        ],
        "ioc_code": "INA",
    },
}

This works very well.

However, when we want to display the flag it automatically is looking for flags/ind.gif which of course returns a 404. Would love if we could set a custom flag_url in the complex dictionary format, e.g.:

COUNTRIES_OVERRIDE = {
    "ID": None,
    "IND": {
        "names": [
            _("Indonesia"),
        ],
        "ioc_code": "INA",
        "flag_url": "flags/id.gif",
    },
}

TYIA

Sure, seems like a valid enhancement.