Django 4.2 LTS to 5.2 LTS: what to check
Django 4.2 is listed by the Django project as an unsupported release: its extended support ended on April 7, 2026. Django 5.2 is the next LTS, with extended support listed to April 2028. This guide covers what changed on the way, taken from the official release notes for 5.0, 5.1 and 5.2, and a test strategy for the move.
- Python 3.10 or newer is required (4.2 also ran on 3.8 and 3.9).
- Removals in 5.0 and 5.1 are where code breaks. Search for the items below.
- 5.2 itself removed no features that we could find in its notes; its breaking changes are mostly database and behaviour details.
- Upgrade through each feature release, on each one's latest patch, and run your tests with warnings on first.
Python and database floors
| Django | Python versions it supports |
|---|---|
| 4.2 | 3.8, 3.9, 3.10, 3.11, 3.12 |
| 5.0 | 3.10, 3.11, 3.12 |
| 5.1 | 3.10, 3.11, 3.12, 3.13 (as of 5.1.3) |
| 5.2 | 3.10, 3.11, 3.12, 3.13, 3.14 (as of 5.2.8) |
If your project runs on Python 3.8 or 3.9, the Python upgrade comes first, and it is its own change with its own test run. Database minimums also rose along the way, according to the release notes:
- SQLite: 3.27.0 in 5.0, then 3.31.0 in 5.1.
- MySQL: 8.0.11 or higher in 5.0 (pre-release 8.0.x builds are no longer supported).
- MariaDB: 10.5 or higher in 5.1.
- PostgreSQL: 13 or higher in 5.1, then 14 or higher in 5.2.
- 5.0 also dropped support for
cx_Oracleolder than 8.3, and 5.2 raised the minimumoracledbfrom 1.3.2 to 2.3.0.
Your third-party packages (Django REST framework, django-filter, celery integrations and so on) have to support the new Django too. The Django upgrade guide says that in most cases you will need to upgrade Django-related dependencies as well, and that you may have to wait for a release if a dependency does not support the new version yet.
Removed in Django 5.0
These had finished their deprecation cycle; they were deprecated in Django 4.0 and 4.1, so a 4.2 project can still run them with warnings. In 5.0 they fail or change behaviour.
- Settings:
USE_L10Nis removed,USE_DEPRECATED_PYTZis removed, theSERIALIZEtest setting is removed, and theCSRF_COOKIE_MASKEDtransitional setting is removed. The default ofUSE_TZchanged fromFalsetoTrue, so a project that never set it now gets timezone-aware datetimes. - Timezones: support for
pytztimezones is removed, as is theis_dstargument ofQuerySet.datetimes(),make_aware()and theTrunc*functions. Thedjango.utils.timezone.utcalias is removed (usedatetime.timezone.utc). - Sessions and auth:
django.contrib.sessions.serializers.PickleSerializeris removed.LogoutViewandlogout_then_login()no longer log out onGETrequests, so logout links must becomePOSTforms.CryptPasswordHasheris removed. Subclasses ofRemoteUserBackend.configure_user()must acceptcreated. - ORM: calling
QuerySet.iterator()on a queryset that prefetches related objects now requireschunk_size. Passing unsaved model instances to related filters is no longer allowed. Passingnulls_first=Falseornulls_last=Falsetoasc(),desc()orOrderByis no longer allowed. TheArrayAgg,JSONBAggandStringAggPostgreSQL aggregates no longer return[]or''when there are no rows.ExclusionConstraintno longer acceptsopclasses.cached_property()no longer acceptsname. - Forms and templates: the default form and formset rendering style is now div-based, and the
"django/forms/default.html"and"django/forms/formsets/default.html"templates are removed. Tests that compare rendered form HTML will see differences. - Tests: the
extra_testsargument ofDiscoverRunner.build_suite()andrun_tests()is removed. Passing a response object and a form name toassertFormError()andassertFormSetError()is no longer allowed. - Removed modules:
django.utils.baseconvanddjango.utils.datetime_safe(both undocumented), andGeoModelAdminandOSMGeoAdminin GIS.
Removed in Django 5.1
These were deprecated in 4.2, so they are the removals that a 4.2 project sees warnings for today.
- The model
Meta.index_togetheroption: move the entries toMeta.indexes. This one touches migrations, so runmakemigrationsafterwards and read what it generates. DEFAULT_FILE_STORAGEandSTATICFILES_STORAGEsettings, anddjango.core.files.storage.get_storage_class(): use theSTORAGESsetting.BaseUserManager.make_random_password()and thelength_istemplate filter.- The
SHA1PasswordHasher,UnsaltedSHA1PasswordHasherandUnsaltedMD5PasswordHasherpassword hashers. Check that no stored password hashes depend on them. - PostgreSQL
CICharField,CIEmailField,CITextFieldand theCITextmixin (stubs remain for historical migrations). SimpleTestCase.assertFormsetError()andTransactionTestCase.assertQuerysetEqual().- Passing encoded JSON string literals to
JSONField, and passing positional arguments toSignerandTimestampSigner.
Removed in Django 5.2
We could not find a "features removed" section in the 5.2 release notes. What 5.2 does list as backwards incompatible is below.
Behaviour changes that do not raise errors
These come from the "backwards incompatible changes" sections of the release notes. They tend to show up as a test that fails oddly, or as production data that looks different.
- 5.0: integer fields are validated as 64-bit integers on SQLite. On databases without native
XOR,^now returns rows matched by an odd number of operands. Filtering querysets against overflowing integer values now always returns an empty queryset. Non-UTF-8 form-encoded requests raiseBadRequest. On MariaDB 10.7 and newer,UUIDFieldis created as aUUIDcolumn rather thanCHAR(32), and the release notes give a subclass to keep the old column type for existing fields. - 5.0 admin markup:
AdminSite.site_headeris rendered in a<div>instead of<h1>, and the main content and header areas use<main>and<header>. This matters if you have tests or CSS that depend on admin HTML. - 5.1:
FileFieldraisesFieldErrorwhen saving a file without a name.truncatechars_htmlandtruncatewords_htmluse a new parser, so output can differ slightly. Thedelete_selectedadmin action no longer sendspre_saveandpost_savefor theLogEntryobjects it creates in bulk. - 5.2: MySQL connections default to the
utf8mb4character set instead ofutf8;utf8mb3can still be set inOPTIONSfor legacy databases.UniqueConstraint.violation_error_codeandviolation_error_messageare now always used when provided. The built-in single-argument aggregates (Avg,Count,Max,Min,StdDev,Sum,Variance) raiseTypeErrorwhen called with the wrong number of arguments. Thedebug()context processor is no longer in the default project template.EmailMultiAlternatives.alternativescan only be added to throughattach_alternative().HttpRequest.accepted_typesis sorted by the client's preference. The create and update methods onQuerySetand the user manager listed in the notes now havealters_data=True.
Deprecations to clear now, before 6.0
These are deprecated in 5.0 and 5.1 and still work in 5.2 with warnings. Fixing them while you are in the code costs little and makes the next upgrade shorter. Examples from the release notes: the check argument of CheckConstraint (use condition), passing positional arguments to Model.save(), ModelAdmin.log_deletion(), format_html() called without arguments, the FORMS_URLFIELD_ASSUME_HTTPS setting (the default scheme for forms.URLField will change from http to https in 6.0), and cx_Oracle support.
A test strategy
- Record a baseline on 4.2. Run the full suite on the latest 4.2 patch and write down passes, failures and skips. If tests are red today, an upgrade cannot be judged against them.
- Turn warnings on, on the old version. Python hides deprecation warnings by default. The Django upgrade guide recommends
python -Wa manage.py test(orPYTHONWARNINGS=always pytest) and says to resolve the warnings on your current version before upgrading. Warnings from installed packages may be harmless. - Go through the feature releases. The guide says it is usually easier to upgrade through each feature release (here 4.2, then 5.0, then 5.1, then 5.2), using the latest patch of each, and recommends the same approach from one LTS to the next. You can pin and test each step in CI even if you only deploy 5.2.
- Upgrade the Django-related packages with each step, and run the suite with
-Waagain. Fix failures; do not delete, skip or loosen tests to get green. - Check migrations.
makemigrations --checkexits non-zero when model changes have no migration (it implies--dry-run). Run it before and after, and read any migration that appears, especially after theindex_togetherchange and forUUIDFieldon MariaDB. - Run the deployment checks with
django-admin check --deployagainst your production settings module. - Exercise what tests skip: logout links, admin pages, form rendering, file uploads and anything on the database engine you run in production if your tests use another.
- After deploy: the upgrade guide suggests clearing the cache, because cached objects are not guaranteed to be compatible across Django versions.
In our own test upgrades of open-source projects, the Django 4.2 to 5.2 moves we ran were small, because those projects already supported 5.2 and the work was moving CI and lockfiles and proving it. The one multi-LTS hop we tried (2.2 to 5.2) did not reach green in three attempts: it hit a removed index_together, a REST framework release that dropped a documentation view and added a new check, and a third-party package that changed a method signature. That is why a two-LTS jump is not offered yet.
Start with the $79 baseline check: we run your tests as they are today and report passes, failures and skips, with no code changed. If your project has at least 30 meaningful tests and CI that is green today, the fixed price for one Django LTS to the next (4.2 to 5.2) is $299, delivered as a pull request or patch. The same price covers moving the Python runtime to the current release when the framework moves at most one LTS. The baseline fee is credited to an upgrade ordered within 30 days. The delivery check is that your own tests pass at least as well as before, with none deleted, skipped or weakened, and every package we held back is listed with the reason. If we cannot deliver a result that meets it, you pay nothing beyond the baseline fee. Django jumps across two or more LTS releases are not offered yet; a baseline check is available for those. Green tests cover only what your tests cover, and we tell you where they do not reach.
Sources
- Django 4.2 release notes (Python 3.8 to 3.12,
index_togetherdeprecation) - Django 5.0 release notes (Python floor, backwards incompatible changes, features removed and deprecated)
- Django 5.1 release notes (database minimums, features removed and deprecated)
- Django 5.2 release notes (Python versions, LTS status, backwards incompatible changes)
- Django deprecation timeline (5.1 removals and 6.0 items)
- Django: Upgrading Django to a newer version (warnings, incremental upgrades, cache)
- django-admin and manage.py reference (
makemigrations --check,check --deploy) - Django: supported versions table (4.2 and 5.2 support dates)
Written 2026-11-18 against the Django documentation as published that day. This guide lists the changes that most often matter; it is not a substitute for reading the release notes for your own code.