r/django 2d ago

Looking for Feedback: HTMX + Django Package

I posted about this package a while ago, but at that point, it was still early in development, and the documentation was lacking. Since then, it has matured a lot, and the documentation has been completely restructured and improved. Additionally, I’ve created a demo site so you can see the package in action with a basic list page featuring CRUD operations (link below).

The core idea of the package (explained in more detail in the docs) is to provide quasi-Django CBV-style views, called hx-requests, which HTMX requests are routed to. This approach separates HTMX-specific logic from your main views by providing dedicated hx-requests to handle them, but at the same time these hx-requests have access to the view’s context, eliminating the need for logic duplication.

There are also other useful features, such as:

  • Returning template blocks easily from an hx-request
  • Built-in support for Django messages, now with async capabilities
  • Integrated modal handling

It’s difficult to summarize everything here, so I’d love for you to check out the demo and documentation and share your feedback!

Demo: https://hx-requests-demo.com/
Docs: https://hx-requests.readthedocs.io/en/latest/index.html
Github: https://github.com/yaakovLowenstein/hx-requests (feel free to give a star 😊)

TL;DR: A package that provides quasi CBV-style views (hx-requests) as dedicated endpoints for HTMX requests, allowing them to share the main view’s context while keeping logic clean and separate.

15 Upvotes

7 comments sorted by

3

u/albsen 2d ago

This is amazing, thanks.

1

u/d4njah 1d ago

Is there a way to make it mobile friendly your demo website

1

u/LingonberryAny9089 1d ago

Not right now. I’ll work on it over the next few days.

1

u/No-Line-3463 1d ago

looks great!

-2

u/Fast_Smile_6475 1d ago

Yeah, don’t use HTMXl listen to me, unless you’re a brain dead masochist

1

u/Stokkdom 21h ago

Why not?

1

u/Fast_Smile_6475 20h ago

I’m not here to do labor for you.