2.1.15

Latest release in branch 2.1
Released 6 years ago (December 02, 2019)

Software Django
Branch 2.1
Status
End of life
End of mainstream support April 01, 2019
End of extended support December 02, 2019
First official release version 2.1
First official release date 7 years ago (August 01, 2018)
Supported
Python versions
Python 3.5 - 3.7
Release notes https://docs.djangoproject.com/en/2.1/releases/
Source code https://github.com/django/django/tree/2.1.15
Documentation https://docs.djangoproject.com/en/2.1/
Django 2.1 Releases View full list

What Is New in Django 2.1

Django 2.1 introduces a focused set of enhancements, primarily a major new feature for model view restrictions and several quality-of-life improvements for developers.

Category Key Changes
New Features Model view permission, In database lookup for fields with choices
Improvements Faster model saving, QuerySet explanation in shell, dbshell management command for Oracle
Backend Support Dropped support for PostgreSQL 9.3 and Oracle 11.2
Miscellaneous New django.contrib.postgres features, HttpRequest method updates

How does the new model view permission work?

The new model view permission (can_view) allows for read-only access to objects without granting change or delete rights. This is a major addition for applications that need to expose data for viewing by certain users without enabling modification. The permission is created automatically for each model and can be handled through Django's standard permission system.

In practice, this simplifies building dashboards or reporting interfaces where users should only see data. You can check this permission in your views using request.user.has_perm('app.view_modelname') or use it with Django's permission mixins for class-based views.

What database lookups were added for fields with choices?

You can now use the In lookup directly on fields that have their choices defined. For example, if a field status has choices 'draft' and 'published', you can query with Model.objects.filter(status__in=['draft']).

This matters because it provides a cleaner, more intuitive way to filter based on the allowed choice values. Previously, this was possible but the new integration makes the intent of the query clearer and more consistent with other lookups.

What performance improvements were made for saving models?

Saving model instances with multi-table inheritance is now faster. The optimization reduces the number of database queries needed when saving a child model instance, specifically by avoiding an unnecessary SELECT to check if the parent already exists.

This is a welcome change for data-heavy applications using complex model inheritance. The performance gain scales with the number of saves you perform, making bulk operations noticeably more efficient.

Why were older database versions dropped?

Support for PostgreSQL 9.3 and Oracle 11.2 was removed. This decision aligns with the end-of-life cycles of those database versions, allowing the Django core team to utilize newer SQL features and reduce maintenance overhead for unsupported software.

If you're upgrading to Django 2.1, you must be running at least PostgreSQL 9.4 or Oracle 12.1. This is a standard practice in the ecosystem to keep the framework modern and secure.

FAQ

Does the new view permission work with the Django admin?
Yes, the view permission integrates with the admin. Users with only the view permission for a model will see a read-only version of the object's detail page in the admin interface.

I use the In lookup already. What changed?
The In lookup itself isn't new. The change is that it's now specifically supported and documented for fields with a choices attribute, making its usage more official and clear for that context.

How do I try the improved QuerySet explanation?
Run python manage.py shell and then print a query with print(MyModel.objects.all().query). The output is now more readable and easier to understand for debugging purposes.

What happened to the old django.core.urlresolvers module?
It was already deprecated in an earlier version. Django 2.1 completes its removal. You must now import from django.urls for items like reverse and include.

Is the dbshell improvement for Oracle a big deal?
If you use Oracle, yes. The dbshell management command now properly works with the Oracle backend, which it didn't before. It's a small but crucial fix for developers who work directly with the database shell.

Releases In Branch 2.1

Version Release date
2.1.15 6 years ago
(December 02, 2019)
2.1.14 6 years ago
(November 04, 2019)
2.1.13 6 years ago
(October 01, 2019)
2.1.12 6 years ago
(September 02, 2019)
2.1.11 6 years ago
(August 01, 2019)
2.1.10 6 years ago
(July 01, 2019)
2.1.9 6 years ago
(June 03, 2019)
2.1.8 7 years ago
(April 01, 2019)
2.1.7 7 years ago
(February 11, 2019)
2.1.6 7 years ago
(February 11, 2019)
2.1.5 7 years ago
(January 04, 2019)
2.1.4 7 years ago
(December 03, 2018)
2.1.3 7 years ago
(November 01, 2018)
2.1.2 7 years ago
(October 01, 2018)
2.1.1 7 years ago
(August 31, 2018)
2.1 7 years ago
(August 01, 2018)
2.1rc1 7 years ago
(July 18, 2018)
2.1b1 7 years ago
(June 18, 2018)
2.1a1 7 years ago
(May 18, 2018)