'poll_extras' is not a registered tag library. But I already registered one

587 Views Asked by At

This is my customize poll_extras.py file

from django import template

register = template.Library()


def titless(value):
    """convert a string to upper case"""
    return value.title()


register.filter('titless', titless)

I have created this file in (templatetags>> this dir contain init.py file and poll_extras.py file also this dir is inside my poll app )

then I used this tags in one html file (named >> poll.html)

here is poll.html few line

{% extends 'base.html' %}
{% load poll_extras %}

{% block content %}

<h2>{{"vote vage" | titless}}</h2>
<h3>{{question.title}}</h3>

.....

Now i am getting this error

'poll_extras' is not a registered tag library.

but i did register

here is tree if helpful

+---ems
|   +---static
|   |   \---css
|   |           styles.css
|   |
|   \---templates
|       |   base.html
|       |
|       +---auth
|       |       login.html
|       |       success.html
|       |
|       +---employee
|       |       add.html
|       |       delete.html
|       |       detail.html
|       |       edit.html
|       |       home.html
|       |
|       \---polls
|               detail.html
|               index.html
|               poll.html
|
\---polls
    |   admin.py
    |   apps.py
    |   context_processors.py
    |   models.py
    |   tests.py
    |   urls.py
    |   views.py
    |   __init__.py
    |
    +---migrations
    |       0001_initial.py
    |       0002_auto_20210324_1407.py
    |       0003_answer.py
    |       __init__.py
    |
    \---templatetags
            poll_extras.py
            __init__.py
0

There are 0 best solutions below