-
Notifications
You must be signed in to change notification settings - Fork 766
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
Alias only_fields
as fields
and exclude_fields
as exclude
#691
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for deprecating "only_fields", to quote the zen of python: "There should be one-- and preferably only one --obvious way to do it."
…lds and only_fields
Co-Authored-By: Semyon Pupkov <semen.pupkov@gmail.com>
dc330e7
to
730e17f
Compare
@zbyte64 I agree. I've updated the PR to start raising |
+1 to requiring that you specify either fields or exclude! |
To make it easier for developers who have used Django REST Framework before, change
only_fields
tofields
andexclude_fields
toexclude
so that it matches theModelSerializer
: https://www.django-rest-framework.org/api-guide/serializers/#specifying-which-fields-to-includeonly_fields
andexclude_fields
will still work and we can drop them in a future release.This PR also includes type checking on the options and support for the
__all__
value to select allfields
(which mirrors DRF).Questions
In a future I think we should enforce that either
fields
orexclude
should be required on all DjangoObjectTypes. What you think @phalt @zbyte64 @patrick91 @mvanlonden @dopeboy ?Also do you think we should start logging
PendingDeprecationWarning
foronly_fields
andexclude_fields
?