I’m trying to test out the partial templates in Django 6, but running into errors I can’t figure out.
Here is index.html:
<p>No polls are available.</p>
{{ hello }}
<hr>
{% include "./partial.html" %}
<hr>
{% include "./partial.html#bar" %}
{% partial bar %}
And partial.html, sibling to index.html:
{% partialdef bar %}
Hello Partial
{% endpartialdef %}
partial.html
I’m getting error from the {% partial bar %} line:
TemplateSyntaxError at /polls/
Partial 'bar' is not defined in the current template.
If I remove that line it renders without errors.
If I place the partial definition in the same file as index.html it also renders without errors.
From what I can tell I’m doing what the documentation describes:
Template partials can also be included using the
includetemplate tag with the same#directive:{% include "authors.html#user-info" %}
But, clearly I’m missing something. Any ideas to what I’m doing wrong?
