Commit 2f9e938e authored by Daniel W Bond's avatar Daniel W Bond

created templatetag to add gender icons to gender names

parent ab002025
from django import template from django import template
from django.utils.safestring import mark_safe
register = template.Library() register = template.Library()
...@@ -11,3 +12,21 @@ def bc(num): ...@@ -11,3 +12,21 @@ def bc(num):
return "%s B.C." % (positive_value) return "%s B.C." % (positive_value)
else: else:
return num return num
@register.filter(name='gender_icon')
def gender_icon(gender_name):
icon_template = '<i class="fa fa-%s fa-fw"></i>'
if gender_name == 'male':
icon_tag = (icon_template % 'mars') + " Male"
elif gender_name == 'female':
icon_tag = (icon_template % 'venus') + " Female"
elif gender_name == 'trans':
icon_tag = (icon_template % 'transgender') + " Trans"
elif gender_name == 'intersex':
icon_tag = (icon_template % 'transgender-alt') + " Intersex"
elif gender_name == 'genderless':
icon_tag = (icon_template % 'genderless') + " Genderless"
elif gender_name == 'other':
icon_tag = (icon_template % 'mars-stroke-v') + " Other"
return mark_safe(icon_tag)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment