Web Development

Django 2.2 alpha 1.0 is now out with constraints classes, and more!

2 min read

Yesterday, the team behind Django released Django 2.2 alpha 1.0. Django 2.2 is designated as LTS, which means it will receive security updates for at least three years after its expected release in April 2019. This version will come with two new constraints classes, some minor features, and deprecates Meta.ordering. It is compatible with Python 3.5, 3.6, and 3.7.

Here are some of the updates that Django 2.2 will come with:

  • Constraints: Two new constraint classes are defined in django.db.models.constraints for adding custom database constraints, namely, CheckConstraint and UniqueConstraint. These classes are also imported into django.db.models for convenience.
  • django.contrib.auth: A request argument is added to the RemoteUserBackend.configure_user() method as the first positional argument, if it accepts it.
  • django.contrib.gis: Oracle support is added for the Envelope function and SpatiaLite support for the coveredby and covers lookups.
  • django.contrib.postgres: A new ordering argument is added to the ArrayAgg and StringAgg classes for determining the ordering of aggregated elements. With new BTreeIndex, HashIndex, and SpGistIndex classes, you can now create B-Tree, hash, and SP-GiST indexes in the database.
  • Internationalization: Support and translations are added for the Armenian language.

Backward incompatible updates

Database backend API:

These are some of the changes that will be needed in third-party database backends:

  • They must support table check constraints or set DatabaseFeatures.supports_table_check_constraints to False.
  • Support for ignoring constraints or uniqueness errors while inserting is needed or you can set DatabaseFeatures.supports_ignore_conflicts to False.
  • Support for partial indexes is needed or you can set DatabaseFeatures.supports_partial_indexes to False.
  • DatabaseIntrospection.table_name_converter() and column_name_converter() are now removed. Third-party database backends will may have to implement DatabaseIntrospection.identifier_converter() instead.

Other changes

  • Admin actions: In this version, admin actions now follow standard Python inheritance and are no longer collected from the base ModelAdmin classes.
  • TransactionTestCase serialized data loading: At the end of the test, initial data migrations are now loaded in TransactionTestCase after the flush. Earlier, this data was loaded at the beginning of the test, which prevented the test –keepdb option from working properly.
  • sqlparse: The sqlparse module will be automatically installed with Django as it is now a required dependency. This change is done to simplify a few parts of Django’s database handling.
  • Permissions for proxy models: You can now create permissions for proxy models using the content type of the proxy model rather than the content type of the concrete model.

Read Next

Django 2.1.2 fixes major security flaw that reveals password hash to “view only” admin users

Django 2.1 released with new model view permission and more

Python web development: Django vs Flask in 2018

Bhagyashree R

Share
Published by
Bhagyashree R

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago