Metadata-Version: 2.4
Name: django-htmx-tools
Version: 1.0.2
Summary: An assortment of Django mixins and middleware for working with HTMX
Project-URL: Homepage, https://github.com/howieweiner/django-htmx-tools
Project-URL: Repository, https://github.com/howieweiner/django-htmx-tools.git
Project-URL: Issues, https://github.com/howieweiner/django-htmx-tools/issues
Project-URL: Documentation, https://django-htmx-tools.readthedocs.io/
Author-email: Howie Weiner <hello@builtbyhowie.co.uk>
License-Expression: MIT
License-File: LICENSE
Keywords: django,htmx
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: django>=4.2
Provides-Extra: dev
Requires-Dist: commitizen>=3.0; extra == 'dev'
Requires-Dist: django-stubs>=4.2; extra == 'dev'
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest-django>=4.5; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx-autodoc-typehints>=1.24; extra == 'docs'
Requires-Dist: sphinx-rtd-theme>=2.0; extra == 'docs'
Requires-Dist: sphinx>=7.0; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest-cov>=4.0; extra == 'test'
Requires-Dist: pytest-django>=4.5; extra == 'test'
Requires-Dist: pytest>=7.0; extra == 'test'
Description-Content-Type: text/markdown

# django-htmx-tools

[![PyPI version](https://badge.fury.io/py/django-htmx-tools.svg)](https://badge.fury.io/py/django-htmx-tools)
[![Python versions](https://img.shields.io/pypi/pyversions/django-htmx-tools.svg)](https://pypi.org/project/django-htmx-tools/)
[![Django versions](https://img.shields.io/pypi/djversions/django-htmx-tools.svg)](https://pypi.org/project/django-htmx-tools/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Documentation Status](https://readthedocs.org/projects/django-htmx-tools/badge/?version=latest)](https://django-htmx-tools.readthedocs.io/en/latest/?badge=latest)

An assortment of Django mixins and middleware for working with HTMX.

django-htmx-tools provides a collection of utilities to make it easier to build
HTMX-powered Django applications. It includes middleware for proper caching and
authentication handling, as well as mixins and decorators for protecting views.

## Features

- **IsHtmxRequestMixin** - Class-based view mixin for HTMX-only endpoints
- **htmx_only_request** - Function decorator for HTMX-only views
- **is_htmx** - Utility function to check if a request is from HTMX
- **htmx_vary_middleware** - Proper caching headers for HTMX requests
- **htmx_auth_middleware** - Authentication redirect handling for HTMX

## References

- [HTMX Caching](https://htmx.org/docs/#caching)
- [How to Handle Django Login Redirects with HTMX](https://www.caktusgroup.com/blog/2022/11/11/how-handle-django-login-redirects-htmx/)

## Documentation

Please visit [https://django-htmx-tools.readthedocs.io](https://django-htmx-tools.readthedocs.io)
