Django 4.0 has just been released, centering on capabilities in database caching and forms customization for the Python web framework.
A new Redis cache back end offers built-in support for caching with the Redis in-memory database. Users will need a Redis server running either locally or on a remote machine. Python bindings for Redis also will be needed.
Also in Django 4.0, easier customizing is offered for Forms
, Formsets
, and ErrorList
, which are now rendered using the template engine. Released December 7, Django 4.0 can be installed with the pip package installer for Python:
pip install Django==4.0
Elsewhere in Django 4.0, according to release notes:
- An
*expressions
positional argument ofUniqueConstrain()
enables development of functional unique constraints on expressions and database functions. - A scrypt password hasher is more secure and recommended over the PBKDF2 algorithm. But it is not the default, as it requires OpenSSL 1.1 and additional memory.
- The Python standard library’s
zoneinfo
now is the default timezone implementation in Django. - The
admin/base.html
template now has a block header that contains the admin site header. - The
ModelAdmin.get_formset_kwargs()
method allows customizing of keyword arguments passed to the constructor of a formset. - The navigation sidebar has been fitted with a quick filter toolbar.
- A constant variable model, which contains the model class for each model, has been added to
AdminSite.each_context()
. - A
ModelAdmin.search_help_text
attribute allows for specifying descriptive text for the search box. - jQuery has been upgraded from version 3.5.1 to 3.6.0.
- The model section of admindocs now shows cached properties.
- The PostgreSQL back end now supports connecting by a service name. Support has been dropped for PostgreSQL 9.6.
- The Django test runner now supports a
--shuffle o
ption to execute tests in random order.
Django 3.0, which added support for Python async, was released roughly a year ago.