Django 6.1 was released on August 5, 2026. It is not a rewrite, but three of its changes touch code that almost every production Django project has: how related objects are loaded, how deletes are executed, and how email is configured. All three can remove real problems, and one of them (email) will eventually force a settings migration.

This article covers those three features with examples, then the breaking changes and deprecations worth checking before you upgrade. It is written for developers and technical leads who maintain a Django codebase and want to know whether 6.1 is worth planning for now.

Verification note. The feature list and compatibility details below come from the Django 6.1 release notes source text and search summaries of the official pages. I could not open docs.djangoproject.com from the environment I used for research, and I have not run the code below on Django 6.1. Treat the snippets as illustrations of the documented behaviour and confirm names and import paths against the official 6.1 release notes before using them.

Support window and requirements

According to the release notes, Django 6.1 supports Python 3.12, 3.13 and 3.14, with Python 3.15 added in a later patch release (6.1.3). Mainstream support ends in April 2027 and extended support in December 2027.

The database floor has moved:

Database Django 6.1 minimum
PostgreSQL 15 (14 dropped)
MySQL 8.4
MariaDB 10.11
SQLite 3.37.0 (was 3.31.0)

If your Postgres instance is still on 14, the database upgrade is the first task, not the Django one.

Fetch modes: a built-in answer to N+1 queries

The most common Django performance bug is the N+1 query: a loop that touches a related object on each row and runs one query per iteration. The traditional fix is select_related() or prefetch_related(), but you have to remember to add it everywhere, and nothing warns you when you forget.

Django 6.1 adds fetch modes, set per queryset with fetch_mode(). They control what happens when code accesses a field or relation that has not been loaded yet:

  • FETCH_ONE (the default) loads the missing data for that one instance, as before.
  • FETCH_PEERS loads it for every instance that came from the same queryset, in one query. The release notes describe it as an on-demand prefetch_related().
  • FETCH_RAISE raises FieldFetchBlocked (from django.core.exceptions), so unintended queries fail loudly.
from django.db import models

books = Book.objects.fetch_mode(models.FETCH_PEERS)
for book in books:
    print(book.author.name)  # two queries in total, not N + 1

FETCH_PEERS is attractive for existing code: you change one line and the loop collapses to a constant number of queries, with no need to predict which relations a template will touch. FETCH_RAISE is the better tool for tests and strict code paths. Using it on a queryset in a test turns a hidden performance regression into a failing assertion.

Trade-offs to keep in mind:

  • FETCH_PEERS still issues queries lazily. An explicit select_related() that joins in the original query can still be cheaper for relations you always need.
  • Peers are the instances of that queryset. If you slice, filter in Python or mix instances from several querysets, the batching only covers each original set.
  • Custom Model.from_db() overrides need a fetch_mode parameter. Overrides without it are deprecated.

Database-level ON DELETE

ForeignKey.on_delete gains three options that delegate the delete behaviour to the database through the SQL ON DELETE clause: DB_CASCADE, DB_SET_NULL and DB_SET_DEFAULT.

class Comment(models.Model):
    post = models.ForeignKey(Post, on_delete=models.DB_CASCADE)

With the existing CASCADE, Django loads the related objects into memory to collect them (and to send signals) before deleting them. With DB_CASCADE, the database does the work in one statement, which is more efficient for large fan-outs.

The catch is documented: DB_CASCADE does not trigger pre_delete or post_delete signals, because Django never sees the child rows. If you rely on signals to clean up files, invalidate caches or write audit entries, keep CASCADE for those relations. Treat this as a per-relation choice, and review each one that has signal receivers before changing it.

Mailers: multiple email backends

Until now Django had one global email configuration made of EMAIL_BACKEND, EMAIL_HOST and friends. 6.1 introduces a MAILERS setting, a dictionary of named mailers, each with its own BACKEND and OPTIONS:

MAILERS = {
    "default": {
        "BACKEND": "django.core.mail.backends.smtp.EmailBackend",
        "OPTIONS": {"host": "smtp.example.com", "use_tls": True},
    },
}

You pick a mailer with the using argument on the email-sending functions, or look one up through django.core.mail.mailers[alias]. The practical use is splitting traffic, for example transactional mail through one provider and bulk or internal mail through another, without writing connection-juggling code.

MAILERS is opt-in for now, but it is the direction of travel. The release notes deprecate the EMAIL_* settings, mail.get_connection(), the connection argument, fail_silently, and auth_user/auth_password, and say MAILERS will replace the old settings in Django 2028. Two new system checks help along the way: mail.E001 (a deployment check that blocks non-production backends in default) and mail.W001 (warns when default is missing).

Smaller additions worth knowing

  • Database functions and expressions. New UUID4 and UUID7 functions, a JSONNull expression for a JSON scalar null, and BitAnd, BitOr and BitXor aggregates now in core.
  • Content Security Policy. A {% csp_nonce_attr %} template tag, and nonces added to <script>, <style> and <link> elements in built-in and admin templates when the CSP context processor is configured. A new security.W027 check was added.
  • Admin. Actions can appear on the object edit page (@action gains location and description_plural), and the change form gets accessibility improvements.
  • Security defaults. The PBKDF2 default iteration count rises to 1,500,000, and signed cookies use an unambiguous salt by default.
  • Redirects. RedirectView.preserve_request keeps the HTTP method and body using 307/308 redirects.
  • Tasks. @task accepts extra keyword arguments forwarded to task_class, and Task and TaskResult can be pickled.

Upgrade breakages to check first

The release notes list many backwards-incompatible changes. These are the ones most likely to affect an ordinary application:

  1. Cache keys changed for varied pages and template fragments, so the first request after the upgrade is a cache miss. Expect a brief load spike on a busy site.
  2. Signed cookies use a new salt. Existing cookies stop validating unless you set SIGNED_COOKIE_LEGACY_SALT_FALLBACK = True, which is itself deprecated, so use it only as a temporary bridge.
  3. Strict Base64 validation in multipart parsing and database cache decoding means invalid data now raises errors.
  4. Union queries (union(), difference(), intersection()) raise DatabaseError if an ordering field is not selected. Call order_by() with no arguments to clear default ordering.
  5. SQL aliases are quoted, so raw SQL that references mixed-case aliases may need adjusting.
  6. first() and last() no longer fall back to ordering by primary key after order_by() has cleared the ordering.
  7. Email code that passes fail_silently, auth_user or auth_password together with connection now raises TypeError, and EmailMessage.message() raises ValueError if Bcc appears in headers (use bcc).
  8. RemoteUserMiddleware under ASGI no longer adds an HTTP_ prefix to custom request.META lookups.
  9. Third-party database backends and admin template overrides have API and markup changes, so check any package that customises either.
  10. check runs against all databases by default, so it may now connect to databases it previously skipped.

Deprecations to start clearing now include select_related() with no arguments, values_list(flat=True) with no field name, None as a top-level JSON value in JSONField queries (use JSONNull), double-dot template lookups such as {{ book..title }}, and transaction.savepoint() in favour of savepoint_create().

A practical upgrade path

  1. Upgrade Python and the database to supported versions first.
  2. Move to the latest 6.0.x and run your tests with warnings enabled (python -W error::DeprecationWarning) to surface deprecations.
  3. Fix third-party packages that block 6.1. Admin themes and database backends are the usual culprits.
  4. Upgrade to 6.1 on a staging copy and run the full suite, plus manage.py check --deploy.
  5. Plan the cache miss and the signed-cookie change for the release window.
  6. After deploying, adopt features one at a time. Fetch modes in tests are the lowest-risk first step; DB_CASCADE needs a signal audit; MAILERS can wait but should be on the roadmap.

Should you upgrade now?

If you are on 6.0, mainstream support for it has ended and security fixes continue until April 2027, so the upgrade is worth scheduling this quarter. If you are on an older long-term release, plan the step through intermediate versions rather than jumping, and budget more time for the deprecation clean-up. The fetch-mode feature alone can pay for the work on any project with slow list pages.

If you want a second pair of eyes on an upgrade or a query-performance review, see my Python, Django and FastAPI development services, or tell me about your project.

FAQ

What is the difference between FETCH_PEERS and prefetch_related()? prefetch_related() is declared up front and loads the relation for the whole queryset. FETCH_PEERS does the same thing lazily, only when a missing field is first accessed, so you do not need to know in advance which relations will be used.

Does DB_CASCADE replace CASCADE? No. It is an additional option. It is faster for large deletes but skips pre_delete and post_delete signals, so keep CASCADE where signals matter.

Do I have to migrate to MAILERS now? No. It is opt-in in 6.1. The old EMAIL_* settings are deprecated and the release notes say they are replaced in Django 2028.

Which Python versions does Django 6.1 support? Python 3.12 to 3.14, with 3.15 supported as of 6.1.3, according to the release notes.

Can I mix this with FastAPI? Yes, and many teams do. See Django vs FastAPI for how to split responsibilities.

References and further reading

For the wider framework decision, Django versus FastAPI covers where each one fits, and Python and FastAPI development is the service side. The release notes are at Django’s download page. If you are planning an upgrade and want the breakages checked first, tell me your version.

Conclusion

The 6.1 additions are small and worth taking, but the upgrade path is the real work: read the deprecations, run the test suite against the new version, and check the admin and mailer behaviour before you merge.

Frequently asked questions

Is Django 6.1 a safe upgrade from 6.0?

It is a minor release, so it should be, provided your tests pass. The breakages to look for are the deprecations listed in the release notes, not new features.

What do the new fetch modes change?

They let you express more precisely what a query should load, which reduces both round trips and memory. Adopt them where a query is already known to be heavy, not everywhere.

What is the safest order for a Django upgrade?

Run the test suite against the new version first, then the admin and any custom mailers, then deploy. The failures usually show up in code you wrote rather than in the framework.