Django – Simple custom template tag example
Here is my solution (based on a custom tag): Firstly create the file structure. Go into the app directory where the tag is needed, and add these files: templatetags templatetags/__init__.py templatetags/video_tags.py The templatetags/video_tags.py file: from django import template register = template.Library() @register.simple_tag def get_rate(crit, rates): return rates.get(crit=crit).rate The template part, with our tag call: {% … Read more