Django 6, including partial templates?

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 include template tag with the same # directive:

{% include "authors.html#user-info" %}

But, clearly I’m missing something. Any ideas to what I’m doing wrong?

Partial rendering using the partial tag can only used within the same template (as you have seen in regards to the errors)

The key thing with partials is that they can be referenced in template paths using the # symbol. So when using it in with the include tag it ought to render only the partial within the other file. The other place this is useful is specifying a partial when rendering a template from a view