Opened 5 years ago

Closed 5 years ago

#30428 closed Bug (worksforme)

Custom tags not loaded.

Reported by: Ozan Gerdaneri Owned by: nobody
Component: Template system Version: dev
Severity: Normal Keywords: templatetags load fail
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,
I followed the instructions defined in:

https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/

Eventhough {%load poll_extras %} does not give any error, which make me think that all the tags defined in the poll_extras .py file loaded properly, I cannot access the tags defined in the file.

For example, this is the tag definition:

from django import template
register = template.Library()

@register.simple_tag(name='testtag')
def some_function():
    return 5 

This is the error I got when defined like that :

{%load poll_extras %}
{%testtag%}

Invalid block tag on line 89: '"testtag"'. Did you forget to register or load this tag?

Change History (1)

comment:1 by Mariusz Felisiak, 5 years ago

Resolution: worksforme
Severity: Release blockerNormal
Status: newclosed
Summary: Custom tags not loadedCustom tags not loaded.
UI/UX: unset
Version: 2.2master

Thanks for the report, however described code works for me. Please use one of support channels for further help.

Note: See TracTickets for help on using tickets.
Back to Top