[Answered ]-Import Error when use templatetags in Django

2👍

  1. The templatetags folder should live in the app folder:

            App1---
                   __init__.py
                   models.py
                   test.py
                   urls.py
                   views.py
                   templatetags---
                           __init__.py
                           inclusion_test.py
                              ...
    
  2. Did you registered the tag?

Example:

register = template.Library()   
@register.inclusion_tag('platform/templatetags/pagination_links.html')
def pagination_links(page, per_page, link):
👤maersu

Leave a comment