Feel free to contact.
Shahraiz Ali
02 Dec 2019
Django 3.0 release version is out now !!! We will be discussing today whats added and removed so in general what's new in Django 3.0.
Source: OFFICIAL LINK
Welcome to Django 3.0!
we'll start by discussing the compatibility of it with python versions
Python compatibility
According to official documentation Django 3.0 supports Python 3.6, 3.7, and 3.8. We highly recommend and only officially support the latest release of each series.
The Django 2.2.x series is the last to support Python 3.5.
Finally coming to the main topic
What’s new in Django 3.0
MariaDB support
Django now officially supports MariaDB 10.1 and higher. See MariaDB notes for more details.
ASGI support
Django 3.0 begins our journey to making Django fully async-capable by providing support for running as an ASGI application.
This is in addition to our existing WSGI support. Django intends to support both for the foreseeable future. Async features will only be available to applications that run under ASGI, however.
There is no need to switch your applications over unless you want to start experimenting with asynchronous code, but we have documentation on deploying with ASGI if you want to learn more.
Note that as a side-effect of this change, Django is now aware of asynchronous event loops and will block you calling code marked as “async unsafe” - such as ORM operations - from an asynchronous context. If you were using Django from async code before, this may trigger if you were doing it incorrectly. If you see a SynchronousOnlyOperation
error, then closely examine your code and move any database operations to be in a synchronous child thread.
Exclusion constraints on PostgreSQL
The new ExclusionConstraint class enable adding exclusion constraints on PostgreSQL. Constraints are added to models using the Meta.constraints option.
Filter expressions
Expressions that output BooleanField may now be used directly in QuerySet
filters, without having to first annotate and then filter against the annotation.
Enumerations for model field choices
Custom enumeration types TextChoices
, IntegerChoices
, and Choices
are now available as a way to define Field.choices. TextChoices
and IntegerChoices
types are provided for text and integer fields. The Choices
class allows defining a compatible enumeration for other concrete data types. These custom enumeration types support human-readable labels that can be translated and accessed via a property on the enumeration or its members. See Enumeration types for more details and examples.
Minor features
Some minor features have also been added to it which are explained in the docs here
Backwards incompatible changes in 3.0
Dropped support for Oracle 12.1
Upstream support for Oracle 12.1 ends in July 2021. Django 2.2 will be supported until April 2022. Django 3.0 officially supports Oracle 12.2 and 18c.
Dropped support for PostgreSQL 9.4
Upstream support for PostgreSQL 9.4 ends in December 2019. Django 3.0 supports PostgreSQL 9.5 and higher.
Database backend API
django.contrib.admin
- Admin’s model history change messages now prefers more readable field labels instead of field names.
django.contrib.gis
- Support for PostGIS 2.1 is removed.
- Support for SpatiaLite 4.1 and 4.2 is removed.
- Support for GDAL 1.11 and GEOS 3.4 is removed.
Removed private Python 2 compatibility APIs
While Python 2 support was removed in Django 2.0, some private APIs weren’t removed from Django so that third party apps could continue using them until the Python 2 end-of-life.
New default value for the FILE_UPLOAD_PERMISSIONS
setting
In older versions, the FILE_UPLOAD_PERMISSIONS setting defaults to None
. With the default FILE_UPLOAD_HANDLERS, this results in uploaded files having different permissions depending on their size and which upload handler is used.
FILE_UPLOAD_PERMISSION
now defaults to 0o644
to avoid this inconsistency.
New default values for security settings
To make Django projects more secure by default, some security settings now have more secure default values:
- X_FRAME_OPTIONS now defaults to 'DENY'
. - SECURE_CONTENT_TYPE_NOSNIFF now defaults to True
A more detailed version of this update can be found in the official link give at the very top.