Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Followup to set_context removal #7076

Merged
merged 4 commits into from Dec 11, 2019

Conversation

rpkilby
Copy link
Member

@rpkilby rpkilby commented Dec 5, 2019

Hi @tomchristie. Just a review/followup for #7062.

  • Bump deprecation from 3.12 to 3.13 to be inline with our stated deprecation policy.
  • Raise RemovedInDRF313Warning instead of DeprecationWarning.
  • In some methods, pass the serializer instead of the model instance. This is necessary in order to correctly handle field source mappings (will followup in a separate PR). Also, this signature was introduced in Drop set_context() #7062, so breaking it now isn't an API breakage.
  • Change instance = getattr(serializer, 'instance', None) to just serializer.instance. The BaseSerializer declares instance, so I'm not aware of a case where it wouldn't exist.
  • Remove the validator .serializer_field, which is a holdover from set_context.

- Use `RemovedInDRF313Warning` instead of DeprecationWarning
- Update to follow deprecation policy
The `UniqueTogetherValidator` may need to access attributes on the
serializer instead of just the model instance. For example, this is
useful for handling field sources.
@tomchristie
Copy link
Member

Thanks!

@tomchristie tomchristie merged commit de9f1d5 into encode:master Dec 11, 2019
@rpkilby rpkilby deleted the unique-together-updates branch December 11, 2019 09:56
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
* Raise framework-specific deprecation warnings

- Use `RemovedInDRF313Warning` instead of DeprecationWarning
- Update to follow deprecation policy

* Pass serializer instead of model to validator

The `UniqueTogetherValidator` may need to access attributes on the
serializer instead of just the model instance. For example, this is
useful for handling field sources.

* Fix framework deprecation warning in test

* Remove outdated validator attribute
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
* Raise framework-specific deprecation warnings

- Use `RemovedInDRF313Warning` instead of DeprecationWarning
- Update to follow deprecation policy

* Pass serializer instead of model to validator

The `UniqueTogetherValidator` may need to access attributes on the
serializer instead of just the model instance. For example, this is
useful for handling field sources.

* Fix framework deprecation warning in test

* Remove outdated validator attribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants