'course_custom_tags' is not a registered tag library. Must be one of:

I am trying to add templatetags in using django, but i get this error after creating the template tags, i don’t know if there is something i need to change in my settings.py to make this work.

{% extends 'base/base.html' %}
{% load static %}

{% load course_custom_tags %}

{% block content %}


from course.models import UserCourse , Course 
register = template.Library()

def is_enrolled(request , course):
    user = None
    if not request.user.is_authenticated:
        return False
        # i you are enrooled in this course you can watch every video
    user = request.user
        user_course = UserCourse.objects.get(user = user  , course = course)
        return True
        return False


Every time I’ve created custom template tags, I put the directory inside the app directory.

From the docs for Custom Tags:

The most common place to specify custom template tags and filters is inside a Django app.


When a Django app is added to INSTALLED_APPS , any tags it defines in the conventional location described below are automatically made available to load within templates.

It looks to me here like you’ve got this directory at the “project” level and not within an app.

1 Like

Thanks, it worked. It was at the root directory before instead of the app