-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Description
Spun off #15585 - django 5.2 (and previous releases) added new features we might want to use to make our code more maintainable (less special sauce). Not all of the features will actually be useful (I just read the release notes; didn't fully investigate); and some may be too much work to implement in existing code, compared to the improvements.
Acceptance Criteria
New features we might want to make use of:
- The new Field.db_default parameter sets a database-computed default value.
- The new GeneratedField allows creation of database generated columns. This field can be used on all supported database backends to create a field that is always computed from other fields.
- The new body_contains() method returns a boolean indicating whether a provided text is contained in the email body and in all attached MIME type text/* alternatives.
- The new operation AlterConstraint is a no-op operation that alters constraints without dropping and recreating constraints in the database.
- The new HttpResponse.text property provides the string representation of HttpResponse.content.
- reverse() and reverse_lazy() now accept query and fragment keyword arguments, allowing the addition of a query string and/or fragment identifier in the generated URL, respectively.
- The new LoginRequiredMiddleware redirects all unauthenticated requests to a login page. Views can allow unauthenticated requests by using the new login_not_required() decorator. LoginRequiredMiddleware respects the login_url and redirect_field_name values set via the login_required() decorator, but does not support setting login_url or redirect_field_name via the LoginRequiredMixin.
- ModelAdmin.list_display now supports using __ lookups to list fields from related models.
- The new DomainNameValidator validates domain names, including internationalized domain names. The new validate_domain_name() function returns an instance of DomainNameValidator.
- Properties in ModelAdmin.list_display now support boolean attribute.
- The new MessagesTestMixin.assertMessages() assertion method allows testing messages added to a response.
- The new create_defaults argument of QuerySet.update_or_create() and QuerySet.aupdate_or_create() methods allows specifying a different field values for the create operation.
Deprecations in 5.x that don't block 4.2->5.2, but could block a future 5.2->6.2 upgrade:
- The check keyword argument of CheckConstraint is deprecated in favor of condition.
- Passing positional arguments name and violation_error_message to BaseConstraint is deprecated in favor of keyword-only arguments.
┆Issue is synchronized with this Jira Task
Metadata
Metadata
Assignees
Labels
No labels