{% extends "_base.html" %} {% load partials %} {% block main %}

This example shows you how you can do partial rendering for htmx requests using django-template-partials. The view renders only the content of the table section partial for requests made with htmx, saving time and bandwidth. Paginate through the below list of randomly generated people to see this in action, and study the view and template.

See more in the docs.

{% partialdef table-section inline %}
{% for person in page.object_list %} {% empty %} {% endfor %}
id name
{{ person.id }} {{ person.name }}
No people on this page.
{% endpartialdef %} {% endblock main %}