# Upgrade Django v6.0.x

Django 6.0 introduces powerful new features for building modern web applications, including built-in Content Security Policy support, template partials for cleaner code organization, a background tasks framework, and a modernized email API. This release also drops support for Python 3.10 and 3.11, requiring Python 3.12 or higher.

## Release Highlights:

- Built-in Content Security Policy (CSP) framework with middleware and configuration settings to protect against injection attacks.
- Template partials via `{% partialdef %}` and `{% partial %}` tags enable reusable template fragments without creating separate files.
- Background tasks framework for defining and queuing tasks outside the request-response cycle using decorators.
- Modernized email API using Python's native email implementation for cleaner Unicode handling.
- `AsyncPaginator` and `AsyncPage` classes for async-compatible pagination.
- New `forloop.length` variable available in template loops.
- `StringAgg` aggregate function now available on all database backends.
- Font Awesome 6.7.2 icons in the admin interface.

## Upgrade Gotchas:

- **Python version requirement**: Django 6.0 requires Python 3.12, 3.13, or 3.14. Python 3.10 and 3.11 are no longer supported.
- **MariaDB version requirement**: MariaDB 10.5 support has been dropped; MariaDB 10.6+ is now required.
- **DEFAULT_AUTO_FIELD change**: The default value changed from `AutoField` to `BigAutoField`. Existing projects should explicitly set this in settings if they want to keep using `AutoField`.
- **ORM expression parameters**: Custom ORM expressions must now return parameters as tuples instead of lists.
- **Email API changes**: The `mixed_subtype`, `alternative_subtype`, and `encoding` properties have been removed from email classes. Positional arguments in `django.core.mail` APIs are deprecated and require keyword arguments.
- **JSON serializer output**: The JSON serializer now adds a newline to output, which may affect tests or integrations that compare exact output.
- **Database backend changes**: Custom database backends need to update `returning_columns()` and `fetch_returned_rows()` implementations.

## Major Features:

- Content Security Policy (CSP) support with built-in middleware and context processors
- Template partials with `{% partialdef %}` and `{% partial %}` template tags
- Background tasks framework with decorator-based task definition and configurable backends
- Modern email API based on Python's native `email` module implementation
- Async pagination support with `AsyncPaginator` and `AsyncPage`
- `AnyValue` aggregate for SQLite, MySQL, Oracle, and PostgreSQL 16+

Source: https://upgradedjango.com/6.0/
