Add template tag to render icons directly from the templates
This commit is contained in:
0
apps/icons/templatetags/__init__.py
Normal file
0
apps/icons/templatetags/__init__.py
Normal file
16
apps/icons/templatetags/icon_tags.py
Normal file
16
apps/icons/templatetags/icon_tags.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.template import Library
|
||||
|
||||
from icons import Icon
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def icon_small(icon_name):
|
||||
print "*******icon_name", icon_name
|
||||
return Icon(icon_name).display_small()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def icon_big(icon_name):
|
||||
return Icon(icon_name).display_big()
|
||||
Reference in New Issue
Block a user