From 5ad467aa2c76a7cfb6218f6dbe22e314131bde3c Mon Sep 17 00:00:00 2001 From: iamkorniichuk <119371190+iamkorniichuk@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:30:29 +0200 Subject: [PATCH 001/124] Remove read_only deprecated behaviour from documentation (#9239) --- docs/api-guide/validators.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md index 2a93e4cdc..e181d4c61 100644 --- a/docs/api-guide/validators.md +++ b/docs/api-guide/validators.md @@ -173,11 +173,9 @@ If you want the date field to be entirely hidden from the user, then use `Hidden # Advanced field defaults Validators that are applied across multiple fields in the serializer can sometimes require a field input that should not be provided by the API client, but that *is* available as input to the validator. +For this purposes use `HiddenField`. This field will be present in `validated_data` but *will not* be used in the serializer output representation. -Two patterns that you may want to use for this sort of validation include: - -* Using `HiddenField`. This field will be present in `validated_data` but *will not* be used in the serializer output representation. -* Using a standard field with `read_only=True`, but that also includes a `default=…` argument. This field *will* be used in the serializer output representation, but cannot be set directly by the user. +**Note:** Using a `read_only=True` field is excluded from writable fields so it won't use a `default=…` argument. Look [3.8 announcement](https://www.django-rest-framework.org/community/3.8-announcement/#altered-the-behaviour-of-read_only-plus-default-on-field). REST framework includes a couple of defaults that may be useful in this context. @@ -189,7 +187,7 @@ A default class that can be used to represent the current user. In order to use default=serializers.CurrentUserDefault() ) -#### CreateOnlyDefault +#### CreateOnlyDefault A default class that can be used to *only set a default argument during create operations*. During updates the field is omitted. From df89f32b88022828ca5d1b5e04be36d54f506e6c Mon Sep 17 00:00:00 2001 From: Victorien <65306057+Viicos@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:02:02 +0100 Subject: [PATCH 002/124] Fix typo in 3.14 announcement (#9255) --- docs/community/3.14-announcement.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/community/3.14-announcement.md b/docs/community/3.14-announcement.md index e7b10ede1..991c6fc5a 100644 --- a/docs/community/3.14-announcement.md +++ b/docs/community/3.14-announcement.md @@ -28,10 +28,10 @@ Our requirements are now: * Python 3.6+ * Django 4.1, 4.0, 3.2, 3.1, 3.0 -## `raise_exceptions` argument for `is_valid` is now keyword-only. +## `raise_exception` argument for `is_valid` is now keyword-only. Calling `serializer_instance.is_valid(True)` is no longer acceptable syntax. -If you'd like to use the `raise_exceptions` argument, you must use it as a +If you'd like to use the `raise_exception` argument, you must use it as a keyword argument. See Pull Request [#7952](https://github.com/encode/django-rest-framework/pull/7952) for more details. From 2ef77b18335322f10c8c6160b6f7794ff6bc92b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Fuayip=20=C3=BCz=C3=BClmez?= <17948971+realsuayip@users.noreply.github.com> Date: Tue, 20 Feb 2024 01:28:04 +0300 Subject: [PATCH 003/124] Use POST method instead of GET to perform logout in browsable API (#9208) * Use POST method instead of GET to perform logout in browsable API * Add a test that checks the presence of the logout form --- rest_framework/templates/rest_framework/admin.html | 2 +- rest_framework/templates/rest_framework/base.html | 2 +- rest_framework/templatetags/rest_framework.py | 13 +++++++++---- tests/browsable_api/test_browsable_api.py | 6 ++++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/rest_framework/templates/rest_framework/admin.html b/rest_framework/templates/rest_framework/admin.html index 7c6917e2d..a5edf529e 100644 --- a/rest_framework/templates/rest_framework/admin.html +++ b/rest_framework/templates/rest_framework/admin.html @@ -42,7 +42,7 @@