summaryrefslogtreecommitdiffstats
path: root/main/templatetags/flags.py
blob: 54115d357845efa8abcb9bdcd233833bc4b7dc81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from django import template
from django.utils.html import format_html

register = template.Library()


@register.simple_tag
def country_flag(country):
    if not country:
        return ''
    return format_html('<span class="fam-flag fam-flag-%s" title="%s"></span> ' % (
        str(country.code).lower(), str(country.name)))


# vim: set ts=4 sw=4 et: