# Upgrade Django v5.1.x

Django 5.1 ships with several exciting new features that enhance developer productivity, security, and performance. Among its many additions, new template utilities,
improved database connection handling, and middleware enhancements stand out as real game changers.

## Release Highlights:

- Introduction of the `{% querystring %}` template tag for easier URL query parameter manipulation.
- Support for PostgreSQL connection pools to reduce latency when establishing new DB connections.
- `LoginRequiredMiddleware` to enforce authentication on a global level while allowing exceptions with a dedicated decorator.
- Enhanced async support across session backends, providing asynchronous APIs for session operations.
- Numerous improvements in accessibility across error pages, admin templates, and form fieldsets.

## Upgrade Gotchas:

- Several backwards-incompatible changes, such as dropped support for older PostgreSQL, MariaDB, PostGIS, and GDAL versions, require careful upgrading.
- Some deprecated features have been removed in Django 5.1, so reviewing the [deprecation notices](https://docs.djangoproject.com/en/5.1/releases/5.1/#features-deprecated-in-5-1) and [migration guides](https://docs.djangoproject.com/en/5.1/releases/5.1/#features-removed-in-5-1) is necessary before upgrading.
- **Storage settings removed**: The `DEFAULT_FILE_STORAGE` and `STATICFILES_STORAGE` settings (deprecated in Django 4.2) have been removed in Django 5.1. You must migrate to the [`STORAGES`](https://docs.djangoproject.com/en/5.1/ref/settings/#storages) setting dictionary instead. See the [Django 4.2 deprecation docs](https://docs.djangoproject.com/en/4.2/ref/settings/#default-file-storage) for migration guidance.

## Major Features:

- `{% querystring %}` template tag for streamlined query parameter manipulation in URLs.
- PostgreSQL connection pool support to cut down on connection delays.
- `LoginRequiredMiddleware` that globally enforces authentication with an option to exempt views using the `login_not_required` decorator.
- Async improvements in Django's session engines enabling asynchronous operations on sessions.

Source: https://upgradedjango.com/5.1/
