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 suggestspartialdef,partial,endpartialdefandendpartialtags.Navigation to partial definitions: place the caret on a partial name in
{% partial %}tag and press Ctrl+B to navigate to the correspondingpartialdefblock.Support for inline partial definitions: PyCharm recognizes partials defined with the
inlinekeyword.
Define template partials
A partial can be defined with the {% partialdef %} tag.
For example, the following partial defines a reusable fragment named comment-item:
Use template partials
A defined partial can be rendered using the {% partial %} tag: