From 9aae7d496d32f74247b33bf5fb90a00fa8938602 Mon Sep 17 00:00:00 2001 From: denisSurkov Date: Tue, 25 Jul 2023 22:35:56 +0500 Subject: [PATCH] Add note for HiddenField behavior --- docs/api-guide/fields.md | 6 ++++++ docs/api-guide/validators.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index 4ac3e3c31..e20ab0c7f 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -550,6 +550,12 @@ The `HiddenField` class is usually only needed if you have some validation that For further examples on `HiddenField` see the [validators](validators.md) documentation. +--- + +**Note:** `HiddenField()` does not appear in `partial=True` serializer (when making `PATCH` request). This behaviour might be changed, follow updates on [github discussion](https://github.com/encode/django-rest-framework/discussions/8259). + +--- + ## ModelField A generic field that can be tied to any arbitrary model field. The `ModelField` class delegates the task of serialization/deserialization to its associated model field. This field can be used to create serializer fields for custom model fields, without having to create a new custom serializer field. diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md index 2a1e3e6b3..615b2e3fb 100644 --- a/docs/api-guide/validators.md +++ b/docs/api-guide/validators.md @@ -164,6 +164,12 @@ If you want the date field to be entirely hidden from the user, then use `Hidden --- +--- + +**Note:** `HiddenField()` does not appear in `partial=True` serializer (when making `PATCH` request). This behaviour might be changed, follow updates on [github discussion](https://github.com/encode/django-rest-framework/discussions/8259). + +--- + # 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.