interstar
interstar

Reputation: 27196

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?

Upvotes: 0

Views: 400

Answers (2)

Daniel Roseman
Daniel Roseman

Reputation: 599778

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

Upvotes: 2

Edward Dale
Edward Dale

Reputation: 30143

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

Upvotes: 2

Related Questions