Search code examples
djangodjango-templatesdjango-custom-tags

Error with custom inclusion_tag, can't find file


I'm trying to write a custom inclusion_tag in django.

Following the example on http://docs.djangoproject.com/en/dev/howto/custom-template-tags/

I'm just writing

@register.inclusion_tag('test.html')

where test.html is a file in the same directory ( apps/my_app/templatetags) as the .py file which defines it.

But I'm getting a

TemplateDoesNotExist: test.html

error. Which I suppose is because django can't find the template.

How could I check this? And what determines where django looks for the file?


Solution

  • Templates for templatetags go in the same places as those for normal views.