Question

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?

Was it helpful?

Solution

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

OTHER TIPS

I believe the included file is found by searching in the template locations defined in your settings file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top