April 3, 2026

Django Table, Filter and Export With Htmx

Some time ago I wrote a blog post about Htmx and Django-table2 and all went well…

So So

No he didn’t work as I wanted so I did some editing of the code here and there.

We start with the code I didn’t change:

First the model

# blog/model.py

class Post(models.Model):
 title = models.CharField(max_length=400)
 slug = models.SlugField(max_length=400, unique=True, blank=True)
 content = models.TextAreaField()
 date = models.DateTimeField(auto_now_add=True)

The table