Test Serializer exclude for declared fields#5599
Merged
carltongibson merged 2 commits intoencode:masterfrom Nov 20, 2017
Merged
Test Serializer exclude for declared fields#5599carltongibson merged 2 commits intoencode:masterfrom
carltongibson merged 2 commits intoencode:masterfrom
Conversation
Contributor
Contributor
Author
|
@xordoquy - agreed, I just whipped it up given how simple of a change it was. I've added another commit that raises an |
Collaborator
|
For me, an assert here is fine. (Even “good” perhaps 🙂) I’m -1 on supporting the usage from #5596, as per discussion there. It’s my birthday 🍰 today so I’ll leave you folks to decide what to do. |
3578ba6 to
4e7e728
Compare
carltongibson
approved these changes
Nov 20, 2017
Collaborator
carltongibson
left a comment
There was a problem hiding this comment.
OK, this is fine. I'm sure it will help someone. Let's have it.
Contributor
|
It's great! I have the same issue. When you redeclared some field, it won't be filtered. |
georgebabey
pushed a commit
to openedx-unsupported/edx-analytics-data-api
that referenced
this pull request
Aug 29, 2018
Unpinned a number of requirements so they would be upgraded as part of `make upgrade` as recommended by OEP-18. In particular the edx-enterprise-data django app was not pinning edx-drf-extensions which resulted in 2 different versions of DRF in the requirements (one for enterprise-data and one for this IDA). Upgrading DRF resulting in an assertion failure that was added in DRF 3.7.4 ``` Cannot both declare the field 'created' and include it in the CourseProgramMetadataSerializer 'exclude' option. Remove the field or, if inherited from a parent serializer, disable with `created = None`. ``` encode/django-rest-framework#5599 Because the created date was being excluded, it is not needed in the CourseProgramMetadataSerializer and has been removed.
pchiquet
pushed a commit
to pchiquet/django-rest-framework
that referenced
this pull request
Nov 17, 2020
* Test current behavior of exclude+declared field * Assert declared fields are not present in exclude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not particularly inclined towards the change in behavior, but it was fairly trivial to implement.
Thoughts @xordoquy, @carltongibson?