PyCharm 2026.1 Help

Django template partials

PyCharm supports Django template partials, introduced in Django 6.0. Partials allow you to define reusable fragments and render them in other parts of the template.

PyCharm provides the following support for Django template partials:

  • Code completion for partial tags: when typing {% in a Django template, PyCharm suggests partialdef, partial, endpartialdef and endpartial tags.

  • Navigation to partial definitions: place the caret on a partial name in {% partial %} tag and press Ctrl+B to navigate to the corresponding partialdef block.

  • Support for inline partial definitions: PyCharm recognizes partials defined with the inline keyword.

Define template partials

A partial can be defined with the {% partialdef %} tag.

For example, the following partial defines a reusable fragment named comment-item:

{% partialdef comment-item %} <div class="comment" id="comment-{{ comment.id }}"> <strong>{{ comment.author }}</strong> <p>{{ comment.text }}</p> </div> {% endpartialdef %}

    Use template partials

    A defined partial can be rendered using the {% partial %} tag:

    {% partial comment-item %}
      18 March 2026