djangofmt-pre-commit

June 3, 2026 ยท View on GitHub

A pre-commit hook for djangofmt.

Distributed as a standalone repository to enable installing djangofmt via prebuilt wheels from PyPI.

Installation

Add the following to your .pre-commit-config.yaml:

repos:
- repo: https://github.com/UnknownPlatypus/djangofmt-pre-commit
  rev: v0.2.10
  hooks:
    - id: djangofmt

To also lint your templates, add the djangofmt-check hook:

repos:
- repo: https://github.com/UnknownPlatypus/djangofmt-pre-commit
  rev: v0.2.10
  hooks:
    - id: djangofmt
    - id: djangofmt-check

Pass args: [--fix] to djangofmt-check to apply safe fixes automatically.