From 2f93cf4958e36a938404a0ac1ca0a3c46efa14c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Kol=C3=A1=C5=99?= Date: Fri, 10 Nov 2023 21:37:39 +0100 Subject: [PATCH] fix(country-column): fix getting unicode --- fiesta/apps/fiestatables/columns.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fiesta/apps/fiestatables/columns.py b/fiesta/apps/fiestatables/columns.py index 0a127252..d9a441c7 100644 --- a/fiesta/apps/fiestatables/columns.py +++ b/fiesta/apps/fiestatables/columns.py @@ -5,6 +5,7 @@ from django.db.models import Choices, Model from django.db.models.fields.files import FieldFile from django.utils.html import format_html +from django_countries import countries from django_countries.fields import Country from django_tables2.columns import BoundColumn @@ -21,10 +22,11 @@ class CountryColumn(tables.Column): attrs = {"td": {"data-flag": str(True).lower()}} def render(self, value): + c_code = countries.by_name(value) return format_html( "{}", value, - Country(value).unicode_flag, + Country(c_code).unicode_flag if c_code else value, ) def value(self, value):