{"repo":"yaakovLowenstein/hx-requests","free":true,"listed":false,"github":"https://github.com/yaakovLowenstein/hx-requests","clone":"git clone https://github.com/yaakovLowenstein/hx-requests.git","description":"A package to facilitate the use of HTMX with Django","language":"Python","stars":65,"topics":["django","htmx"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"hx-requests Full documentation: hx-requests Documentation Demo Website: https://hx-requests-demo.com/ Installation Requires Python 3.11+ and Django 4.2+ . Overview What Are hx-requests? To start with a high-level explanation, hx-requests are quasi Django + Htmx views. They mimic Django's class-based views but with added functionality to work seamlessly with Htmx. Using a View mixin, it elegantly handles multiple Htmx requests on a single page. Each Htmx request is routed to a specific hx-request (think of it as a view), which returns the necessary HTML to update the DOM. A more detailed explanation can be found below. Why The Name? Excellent question! The package was named early on in the development process when the behavior wasn't exactly clear. All that was clear was that there needed to be an easier way to work with Htmx in Django. Hx comes from Htmx, and requests because every use of Htmx is a request to the server. If it was named today, it would probably be called something like Django-Htmx-Views , but hx-requests has stuck. Why Use hx-requests? This is where we will get into the details of why hx-requests is needed. There are multiple ways of integrating Htmx in a Django project. 1. Using The Page View The most common way is re-hitting the view that loaded the page. The base view: The template: Handling the request: This approach works well for views with one Htmx request, but what if you have multiple Htmx requests on the same page? Handling multiple Htmx requests: I","default_branch":null,"files":null,"tree":[],"storefront":"/r/yaakovLowenstein","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/yaakovLowenstein/hx-requests/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}