django-countries icon indicating copy to clipboard operation
django-countries copied to clipboard

When setting `COUNTRIES_OVERRIDE`, allow custom flag_url

Open kunambi opened this issue 2 years ago • 1 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

kunambi avatar Dec 18 '23 11:12 kunambi

Sure, seems like a valid enhancement.

SmileyChris avatar Apr 01 '24 22:04 SmileyChris