mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 02:53:58 +03:00
Update 3.11-announcement.md (#9227)
This commit is contained in:
parent
21bb21b65b
commit
c4f9d432dd
|
@ -64,7 +64,7 @@ In some circumstances a Validator class or a Default class may need to access th
|
||||||
* Uniqueness validators need to be able to determine the name of the field to which they are applied, in order to run an appropriate database query.
|
* Uniqueness validators need to be able to determine the name of the field to which they are applied, in order to run an appropriate database query.
|
||||||
* The `CurrentUserDefault` needs to be able to determine the context with which the serializer was instantiated, in order to return the current user instance.
|
* The `CurrentUserDefault` needs to be able to determine the context with which the serializer was instantiated, in order to return the current user instance.
|
||||||
|
|
||||||
Previous our approach to this was that implementations could include a `set_context` method, which would be called prior to validation. However this approach had issues with potential race conditions. We have now move this approach into a pending deprecation state. It will continue to function, but will be escalated to a deprecated state in 3.12, and removed entirely in 3.13.
|
Our previous approach to this was that implementations could include a `set_context` method, which would be called prior to validation. However this approach had issues with potential race conditions. We have now move this approach into a pending deprecation state. It will continue to function, but will be escalated to a deprecated state in 3.12, and removed entirely in 3.13.
|
||||||
|
|
||||||
Instead, validators or defaults which require the serializer context, should include a `requires_context = True` attribute on the class.
|
Instead, validators or defaults which require the serializer context, should include a `requires_context = True` attribute on the class.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user