I created a custom tag and getting error as :


Request Method: GET

Request URL: ""

Django Version: 2.2.1

Exception Type: TemplateSyntaxError

Exception Value: Invalid block tag on line 80: ''NOUN_LIST|count_ordered'', expected 'endblock'. Did you forget to register or load this tag?


My Project Structure is :

Project Structure


custom_tag.py :

from django import template
register = template.Library()
@register.simple_tag
def count_ordered(value):
    dict = sorted(value, key=lambda val:len(val.list),reverse=True)
    return dict

I am calling this tag as :

{% load custom_tag %}
{% NOUN_LIST|count_ordered as list %}
{{ list }}

0

There are 0 best solutions below