What is New in Django 6.0
Django 6.0 is a major release that brings modern Python support, stronger security defaults, improved database features, and many quality-of-life enhancements. It requires Python 3.10 or newer and continues the focus on making development faster, safer, and more enjoyable.
Python and Third-Party Compatibility
Django 6.0 officially supports Python versions 3.10, 3.11, 3.12, and 3.13. Older versions like Python 3.8 and 3.9 are no longer supported. Many popular third-party packages already work well with Django 6.0, but always test your specific dependencies during upgrade.
Security Improvements
Content-Security-Policy Headers Made Easier
New helpers simplify adding CSP headers to responses. You can now set policies directly on views or middleware.
from django.csp import csp_header
@csp_header("default-src 'self'; script-src 'self' https://cdn.example.com")
def my_view(request):
return render(request, "template.html")
Better Default Security Settings
Several settings now have stricter defaults, including improved cookie security and protection against common attacks.
Database and ORM Enhancements
Partial Indexes
Create database indexes that only apply to rows matching a condition. Great for filtering out soft-deleted or inactive records.
class Meta:
indexes = [
models.Index(fields=['status'], name='active_idx', condition=models.Q(status='active'))
]
Background Database Tasks
Run heavy operations like bulk updates or complex queries in the background using Django's new async-capable task runner.
Geometry Field Improvements
New GeometryDistance expression and better support for spatial lookups.
BigAutoField as Default Primary Key
All new models now use 64-bit BigAutoField by default instead of the old 32-bit AutoField. Existing projects keep their current behavior.
Forms and Validation
New Formset Features
Better support for dynamic forms, improved error handling, and new methods for working with extra forms.
Atomic Decorators for Views
Use @atomic on class-based views to wrap the entire request in a database transaction.
Improved Message Framework
Messages now support safe HTML by default when using the safe extra tag, and the storage backend has been simplified.
Admin and Management Commands
New aggregate.all() Method
A cleaner way to apply multiple aggregations without grouping.
Better Admin Search and Filtering
Enhanced search fields and list filters with improved performance and usability.
New inspectdb Improvements
The inspectdb command now generates more accurate model definitions from existing databases.
Dropped Support and Backward-Incompatible Changes
Django 6.0 removes several old features to keep the framework modern and secure:
- Python 3.8 and 3.9 are no longer supported
- Old URL resolver syntax has been removed
- Default
AutoFieldreplaced withBigAutoFieldfor new projects - Many deprecated APIs from Django 4.x and 5.x are now fully removed
is_popupvariable in admin templates removed- Old password hasher aliases dropped
- Support for very old database versions removed (PostgreSQL 11, MySQL 5.7, etc.)
Dependency Updates
Minimum required versions for key libraries have been raised:
| Library | Minimum Version |
|---|---|
| asgiref | 3.8.0 |
| sqlparse | 0.5.0 |
| Pillow | 10.0.0 |
| tzdata | 2023.3 |
| PostgreSQL | 12+ |
| MySQL | 8.0.11+ |
| MariaDB | 10.5+ |
| SQLite | 3.33+ |
Upgrade Tips
Before upgrading to Django 6.0:
- Upgrade to Django 5.1 first and resolve all deprecation warnings
- Test your project on Python 3.10 or higher
- Check third-party apps for Django 6.0 compatibility
- Update your primary keys if still using old
AutoField - Review security settings and CSP configuration
Final Thoughts
Django 6.0 delivers a cleaner, faster, and more secure foundation for building web applications. With modern Python support, powerful new database features, and smarter defaults, it helps developers write better code with less effort. This release continues Django's tradition of evolving while staying stable and reliable.