============================================ Django 2.1 release notes - UNDER DEVELOPMENT ============================================ Welcome to Django 2.1! These release notes cover the :ref:`new features `, as well as some :ref:`backwards incompatible changes ` you'll want to be aware of when upgrading from Django 2.0 or earlier. We've :ref:`dropped some features` that have reached the end of their deprecation cycle, and we've :ref:`begun the deprecation process for some features `. See the :doc:`/howto/upgrade-version` guide if you're updating an existing project. Python compatibility ==================== Django 2.1 supports Python 3.5, 3.6, and 3.7. Django 2.0 is the last version to support Python 3.4. We **highly recommend** and only officially support the latest release of each series. .. _whats-new-2.1: What's new in Django 2.1 ======================== Minor features -------------- :mod:`django.contrib.admin` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ * :attr:`.ModelAdmin.search_fields` now accepts any lookup such as ``field__exact``. * jQuery is upgraded from version 2.2.3 to 3.2.1. * The new :meth:`.ModelAdmin.delete_queryset` method allows customizing the deletion process of the "delete selected objects" action. * You can now :ref:`override the the default admin site `. * The new :attr:`.ModelAdmin.sortable_by` attribute and :meth:`.ModelAdmin.get_sortable_by` method allow limiting the columns that can be sorted in the change list page. * The ``admin_order_field`` attribute for elements in :attr:`.ModelAdmin.list_display` may now be a query expression. :mod:`django.contrib.admindocs` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.auth` ~~~~~~~~~~~~~~~~~~~~~~~~~~ * :djadmin:`createsuperuser` now gives a prompt to allow bypassing the :setting:`AUTH_PASSWORD_VALIDATORS` checks. * :class:`~django.contrib.auth.forms.UserCreationForm` and :class:`~django.contrib.auth.forms.UserChangeForm` no longer need to be rewritten for a custom user model. :mod:`django.contrib.contenttypes` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.gis` ~~~~~~~~~~~~~~~~~~~~~~~~~ * The new :meth:`.GEOSGeometry.buffer_with_style` method is a version of :meth:`~.GEOSGeometry.buffer` that allows customizing the style of the buffer. :mod:`django.contrib.messages` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.postgres` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.redirects` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.sessions` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.sitemaps` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.sites` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.staticfiles` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... :mod:`django.contrib.syndication` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ... Cache ~~~~~ * The :ref:`local-memory cache backend ` now uses a least-recently-used (LRU) culling strategy rather than a pseudo-random one. CSRF ~~~~ * ... Database backends ~~~~~~~~~~~~~~~~~ * ... Email ~~~~~ * ... File Storage ~~~~~~~~~~~~ * ... File Uploads ~~~~~~~~~~~~ * ... Forms ~~~~~ * ... Generic Views ~~~~~~~~~~~~~ * ... Internationalization ~~~~~~~~~~~~~~~~~~~~ * ... Management Commands ~~~~~~~~~~~~~~~~~~~ * The new :option:`inspectdb --include-views` option allows creating models for database views. Migrations ~~~~~~~~~~ * Added support for serialization of ``functools.partialmethod`` objects. Models ~~~~~~ * Models can now use ``__init_subclass__()`` from :pep:`487`. * A ``BinaryField`` may now be set to ``editable=True`` if you wish to include it in model forms. * A number of new text database functions are added: :class:`~django.db.models.functions.Chr`, :class:`~django.db.models.functions.Ord`, :class:`~django.db.models.functions.Left`, :class:`~django.db.models.functions.Right`, and :class:`~django.db.models.functions.Replace`. * The new :class:`~django.db.models.functions.TruncWeek` function truncates :class:`~django.db.models.DateField` and :class:`~django.db.models.DateTimeField` to the Monday of a week. * Query expressions can now be negated using a minus sign. * :meth:`.QuerySet.order_by` and :meth:`distinct(*fields) <.QuerySet.distinct>` now support using field transforms. Requests and Responses ~~~~~~~~~~~~~~~~~~~~~~ * Added :meth:`.HttpRequest.get_full_path_info`. Serialization ~~~~~~~~~~~~~ * ... Signals ~~~~~~~ * ... Templates ~~~~~~~~~ * The new :tfilter:`json_script` filter safely outputs a Python object as JSON, wrapped in a ``