Bringing together django, django rest framework, and htmx

Overview

This is Just an Idea

There is no code, this README just represents an idea for a minimal library that, as of now, does not exist.

django-htmx-rest

A library for bringing together Django, the Django REST Framework, and htmx.

htmx is a new javascript library that allows you to access modern browser features directly from HTML, rather than using javascript. See their docs to learn more, it is really awesome!

After learning about htmx, it is natural to realize how htmx can bring Roy Fielding's idea of REST and HATEOS to life in a new, intuitive, and powerful way. Although htmx is a frontend library, it implies a fresh look at the old paradigm for building backend-driven web applications.

Despite all of this being very exciting, sticking htmx into a Django project, or a Django project with DRF does involve a bit of friction. There are a lack of design patterns, best practices, and library support. Of course, we can build vies that "do it all," in the sense of serving JSON alongside htmx-cooperative html snippets, but doing so with consistency, repeatability, and scalability is where this library fits in.

Features

Django and DRF are already tools we know and love. This library aims to smoothly bring htmx into the mix with a minimal framework and utilities that are both easy to use and understand.

HTMX REST Views

We provide thin wrappers around DRF view classes and view function decorators which allow you to provide an html partial template. When a request comes from htmx, the template provided will be used to provide a html snippet for htmx.

Otherwise, the view will behave like a DRF view, able to serve up JSON, XML, et cetera.

New Spin on the Browsable API

With htmx, your browsable API is not just a view into your application data, but also a sort of storybook for UI components, as expressed by HTMX partials.

If you directly visit a htmx-rest view in your browser, you will still be able to access the DRF browsable API, but you'll also be able to see and interact with the HTMX component in isolation with live reloading, and basic UI development tools, like changing the viewport size, and viewing the context data being passed into the template

Also, to help you browse through all your htmx-rest views, our browsable interface has a sidebar listing all of the htmx-rest views in your application, so you can explore them.

Supercharged Content Negotiation

Content negotiation and renders are an awesome part of DRF. This library extends that functionality to provide the tools needed for supporting htmx as well. A request from htmx directly serves up the html snippet, with the serialized data being passed into your partial template. A direct browser request shows the browsable API / component explorer, and other content types are handled by DRF as expected.

Owner
Jack DeVries
Jack DeVries
GeoDjango provides geospatial extensions to the Django web dev framework

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. All documentation is in the "docs" directo

Paul Smith 20 Sep 20, 2022
Django + Next.js integration

Django Next.js Django + Next.js integration From a comment on StackOverflow: Run 2 ports on the same server. One for django (public facing) and one fo

Quera 162 Jan 03, 2023
Bootstrap 3 integration with Django.

django-bootstrap3 Bootstrap 3 integration for Django. Goal The goal of this project is to seamlessly blend Django and Bootstrap 3. Want to use Bootstr

Zostera B.V. 2.3k Jan 02, 2023
Full-featured django project start tool.

django-start-tool Introduction django-start-tool is a full-featured replacement for django-admin startproject which provides cli for creating the same

Georgy Gnezdilov 0 Aug 30, 2022
Easy thumbnails for Django

Easy Thumbnails A powerful, yet easy to implement thumbnailing application for Django 1.11+ Below is a quick summary of usage. For more comprehensive

Chris Beaven 1.3k Dec 30, 2022
Django channels basic chat

Django channels basic chat

Dennis Ivy 41 Dec 24, 2022
pdm-django: Django command shortcuts for PDM

pdm-django: Django command shortcuts for PDM A plugin that gives you command shortcuts for developing with PDM. pdm run python manage.py runserver -

Neutron Sync 2 Aug 11, 2022
A UUIDField for Django

django-uuidfield Provides a UUIDField for your Django models. Installation Install it with pip (or easy_install): pip install django-uuidfield Usage

David Cramer 265 Nov 30, 2022
A Student/ School management application built using Django and Python.

Student Management An awesome student management app built using Django.! Explore the docs » View Demo · Report Bug · Request Feature Table of Content

Nishant Sethi 1 Feb 10, 2022
Django-pwned - A collection of django password validators

Django Pwned A collection of django password validators. Compatibility Python: 3

Quera 22 Jun 27, 2022
This repository contains django library management system project.

Library Management System Django ** INSTALLATION** First of all install python on your system. Then run pip install -r requirements.txt to required se

whoisdinanath 1 Dec 26, 2022
Show how the redis works with Python (Django).

Redis Leaderboard Python (Django) Show how the redis works with Python (Django). Try it out deploying on Heroku (See notes: How to run on Google Cloud

Tom Xu 4 Nov 16, 2021
Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot. A fully Django starter project.

Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot 🚀 Features A Django stater project with fully basic requirements for a production-ready

8 Jun 27, 2022
Tools to easily create permissioned CRUD endpoints in graphene-django.

graphene-django-plus Tools to easily create permissioned CRUD endpoints in graphene-django. Install pip install graphene-django-plus To make use of ev

Zerosoft 74 Aug 09, 2022
A multiprocessing distributed task queue for Django

A multiprocessing distributed task queue for Django Features Multiprocessing worker pool Asynchronous tasks Scheduled, cron and repeated tasks Signed

Ilan Steemers 1.7k Jan 03, 2023
Django admin CKEditor integration.

Django CKEditor NOTICE: django-ckeditor 5 has backward incompatible code moves against 4.5.1. File upload support has been moved to ckeditor_uploader.

2.2k Dec 31, 2022
A pickled object field for Django

django-picklefield About django-picklefield provides an implementation of a pickled object field. Such fields can contain any picklable objects. The i

Gintautas Miliauskas 167 Oct 18, 2022
A better and faster multiple selection widget with suggestions

django-searchable-select A better and faster multiple selection widget with suggestions for Django This project is looking for maintainers! Please ope

Andrew Dunai 105 Oct 22, 2022
A calendaring app for Django. It is now stable, Please feel free to use it now. Active development has been taken over by bartekgorny.

Django-schedule A calendaring/scheduling application, featuring: one-time and recurring events calendar exceptions (occurrences changed or cancelled)

Tony Hauber 814 Dec 26, 2022
Quick example of a todo list application using Django and HTMX

django-htmx-todo-list Quick example of a todo list application using Django and HTMX Background Modified & expanded from https://github.com/jaredlockh

Jack Linke 54 Dec 10, 2022