Skip to content

Instantly share code, notes, and snippets.

@RNCTX
RNCTX / django-template_partials-htmx-tables2-filter_search.md
Last active August 11, 2025 08:44
How to tie HTMX + django-tables2 + django-filters + django-template-partials together

Reasoning for this

It took me some time of digging through disparate docs and blog posts to piece together how to use django-tables2, htmx, django-template-partials, and django-filter, all at the same time in an optimal way for highly interactive data tables in django.
At present I am not using Alpine.js, another popular addition to this stack, due to my preference for writing plain ole javascript instead of having to learn another syntax, but that's really outside of this scope anyway, this is meant to be a how-to on the Python tools + HTMX.

Credit to the following blog posts and stackoverflow replies that were helpful in piecing this stuff together as a first time user of most of these Django packages:

@firdaus-aziz
firdaus-aziz / custom_manager.py
Created January 15, 2021 09:35 — forked from carymrobbins/custom_manager.py
Simple custom Model Manager for Django. Allows you to easy override QuerySet and EmptyQuerySet
from django.db import models
from django.db.models.query import EmptyQuerySet, QuerySet
class CustomManager(models.Manager):
"""
Easily override QuerySet by setting the QuerySet and EmptyQuerySet
inside of the class using inheritance.
"""
EmptyQuerySet = EmptyQuerySet