For others facing this. Suppose your application name is MyApp , and your tag name is templatetags , and then in settings.py should be:
INSTALLED_APPS = [ 'MyApp', 'MyApp.templatetags' ]
You need both your django application and your tag folder located under your application.
-> MyApp ---> models.py ---> views.py ---> templatetags -----> __init__.py -----> app_filters.py
And in your template file:
{% load app_filters %}
Also app_filters.py will look like:
# coding=utf-8 from django import template register = template.Library() @register.filter(name='get_item') def get_item(dictionary, key): return dictionary.get(key)
check all the above steps and you may find the problem.
AmiNadimi Jun 29 '17 at 20:08 2017-06-29 20:08
source share