A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.djangoproject.com/en/dev/releases/2.2/ below:

Django 2.2 release notes | Django documentation

Django 2.2 release notes

April 1, 2019

Welcome to Django 2.2!

These release notes cover the new features, as well as some backwards incompatible changes you’ll want to be aware of when upgrading from Django 2.1 or earlier. We’ve begun the deprecation process for some features.

See the How to upgrade Django to a newer version guide if you’re updating an existing project.

Django 2.2 is designated as a long-term support release. It will receive security updates for at least three years after its release. Support for the previous LTS, Django 1.11, will end in April 2020.

Python compatibility

Django 2.2 supports Python 3.5, 3.6, 3.7, 3.8 (as of 2.2.8), and 3.9 (as of 2.2.17). We highly recommend and only officially support the latest release of each series.

What’s new in Django 2.2 Constraints

The new CheckConstraint and UniqueConstraint classes enable adding custom database constraints. Constraints are added to models using the Meta.constraints option.

Minor features django.contrib.admin django.contrib.auth django.contrib.gis django.contrib.postgres django.contrib.staticfiles Database backends Generic Views Internationalization Management Commands Migrations Models Requests and Responses Serialization Tests URLs Validators Backwards incompatible changes in 2.2 Database backend API

This section describes changes that may be needed in third-party database backends.

Admin actions are no longer collected from base ModelAdmin classes

For example, in older versions of Django:

from django.contrib import admin


class BaseAdmin(admin.ModelAdmin):
    actions = ["a"]


class SubAdmin(BaseAdmin):
    actions = ["b"]

SubAdmin would have actions 'a' and 'b'.

Now actions follows standard Python inheritance. To get the same result as before:

class SubAdmin(BaseAdmin):
    actions = BaseAdmin.actions + ["b"]
django.contrib.gis TransactionTestCase serialized data loading

Initial data migrations are now loaded in TransactionTestCase at the end of the test, after the database flush. In older versions, this data was loaded at the beginning of the test, but this prevents the test --keepdb option from working properly (the database was empty at the end of the whole test suite). This change shouldn’t have an impact on your tests unless you’ve customized TransactionTestCase’s internals.

sqlparse is required dependency

To simplify a few parts of Django’s database handling, sqlparse 0.2.2+ is now a required dependency. It’s automatically installed along with Django.

cached_property aliases

In usage like:

from django.utils.functional import cached_property


class A:
    @cached_property
    def base(self):
        return ...

    alias = base

alias is not cached. Where the problem can be detected (Python 3.6 and later), such usage now raises TypeError: Cannot assign the same cached_property to two different names ('base' and 'alias').

Use this instead:

import operator


class A:
    ...

    alias = property(operator.attrgetter("base"))
Permissions for proxy models

Permissions for proxy models are now created using the content type of the proxy model rather than the content type of the concrete model. A migration will update existing permissions when you run migrate.

In the admin, the change is transparent for proxy models having the same app_label as their concrete model. However, in older versions, users with permissions for a proxy model with a different app_label than its concrete model couldn’t access the model in the admin. That’s now fixed, but you might want to audit the permissions assignments for such proxy models ([add|view|change|delete]_myproxy) prior to upgrading to ensure the new access is appropriate.

Finally, proxy model permission strings must be updated to use their own app_label. For example, for app.MyProxyModel inheriting from other_app.ConcreteModel, update user.has_perm('other_app.add_myproxymodel') to user.has_perm('app.add_myproxymodel').

Merging of form Media assets

Form Media assets are now merged using a topological sort algorithm, as the old pairwise merging algorithm is insufficient for some cases. CSS and JavaScript files which don’t include their dependencies may now be sorted incorrectly (where the old algorithm produced results correctly by coincidence).

Audit all Media classes for any missing dependencies. For example, widgets depending on django.jQuery must specify js=['admin/js/jquery.init.js', ...] when declaring form media assets.

Miscellaneous Features deprecated in 2.2 Model Meta.ordering will no longer affect GROUP BY queries

A model’s Meta.ordering affecting GROUP BY queries (such as .annotate().values()) is a common source of confusion. Such queries now issue a deprecation warning with the advice to add an order_by() to retain the current query. Meta.ordering will be ignored in such queries starting in Django 3.1.

Miscellaneous

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3