django-upgrade

1.30.0 · active · verified Wed Apr 15

django-upgrade is a tool that automatically upgrades your Django project code. It changes code to avoid deprecation warnings and migrates some patterns to newer Django idioms, easing the upgrade process and helping ensure your code uses the latest features. It is currently at version 1.30.0 and is actively maintained.

Warnings

Install

Quickstart

django-upgrade is primarily a command-line tool. You typically run it against your project's Python files, optionally specifying a target Django version. It modifies files in-place by default.

# To apply fixers for Django 4.2 to all Python files in the current directory:
django-upgrade . --target-version 4.2

# Or, to process a specific file and print changes to stdout (without modifying in-place):
# django-upgrade myfile.py -

view raw JSON →