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
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Dec 31, 2022
Учебное пособие по основам Django и сопутствующим технологиям

Учебный проект для закрепления основ Django Подробный разбор проекта здесь. Инструкция по запуску проекта на своей машине: Скачиваем репозиторий Устан

Stanislav Garanzha 12 Dec 30, 2022
Add Chart.js visualizations to your Django admin using a mixin class

django-admincharts Add Chart.js visualizations to your Django admin using a mixin class. Example from django.contrib import admin from .models import

Dropseed 22 Nov 22, 2022
Reusable workflow library for Django

django-viewflow Viewflow is a lightweight reusable workflow library that helps to organize people collaboration business logic in django applications.

Viewflow 2.3k Jan 08, 2023
A debug/profiling overlay for Django

Django Debug Toolbar The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/respons

David Cramer 228 Oct 17, 2022
Utility for working with recurring dates in Django.

django-recurrence django-recurrence is a utility for working with recurring dates in Django. Documentation is available at https://django-recurrence.r

408 Jan 06, 2023
A modern looking portfolio build with Django.

Django Portfolio A portfolio template using html/css/js in the frontend and Django as the backend framework. Cool features: smooth scrolling responsiv

1 Jan 19, 2022
☄️ Google Forms autofill script

lazrr 'Destroy Them With Lazers' - Knife Party, 2011 Google Forms autofill script Installation: pip3 install -r requirements.txt Usage: python3 lazrr.

Serezha Rakhmanov 12 Jun 04, 2022
Tutorial para o projeto negros.dev - A Essência do Django

Negros Dev Tutorial para o site negros.dev Este projeto foi feito com: Python 3.8.9 Django 3.1.8 Bootstrap 4.0 Como rodar o projeto? Clone esse reposi

Regis Santos 6 Aug 12, 2022
Agenda feita usando o django para adicionar eventos

Agenda de Eventos Projeto Agenda com Django Inicio O projeto foi iniciado no Django, usando o models.py foi adicionado os dados dos eventos e feita as

Bruno Fernandes 1 Apr 14, 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
A slick ORM cache with automatic granular event-driven invalidation.

Cacheops A slick app that supports automatic or manual queryset caching and automatic granular event-driven invalidation. It uses redis as backend for

Alexander Schepanovski 1.7k Jan 03, 2023
Django API creation with signed requests utilizing forms for validation.

django-formapi Create JSON API:s with HMAC authentication and Django form-validation. Version compatibility See Travis-CI page for actual test results

5 Monkeys 34 Apr 04, 2022
No effort, no worry, maximum performance.

Django Cachalot Caches your Django ORM queries and automatically invalidates them. Documentation: http://django-cachalot.readthedocs.io Table of Conte

NoriPyt 980 Jan 06, 2023
📊📈 Serves up Pandas dataframes via the Django REST Framework for use in client-side (i.e. d3.js) visualizations and offline analysis (e.g. Excel)

Django REST Pandas Django REST Framework + pandas = A Model-driven Visualization API Django REST Pandas (DRP) provides a simple way to generate and se

wq framework 1.2k Jan 01, 2023
Django backend of Helium's planner application

Helium Platform Project Prerequisites Python (= 3.6) Pip (= 9.0) MySQL (= 5.7) Redis (= 3.2) Getting Started The Platform is developed using Pytho

Helium Edu 17 Dec 14, 2022
A simple plugin to attach a debugger in Django on runserver command.

django-debugger A simple plugin to attach a debugger in Django during runserver Installation pip install django-debugger Usage Prepend django_debugger

Sajal Shrestha 11 Nov 15, 2021
A package to handle images in django

Django Image Tools Django Image Tools is a small app that will allow you to manage your project's images without worrying much about image sizes, how

The Bonsai Studio 42 Jun 02, 2022
Transparently use webpack with django

Looking for maintainers This repository is unmaintained as I don't have any free time to dedicate to this effort. If you or your organisation are heav

Owais Lone 2.4k Jan 06, 2023
Simple tagging for django

django-taggit This is a Jazzband project. By contributing you agree to abide by the Contributor Code of Conduct and follow the guidelines. django-tagg

Jazzband 3k Jan 02, 2023