-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Make serializer fields import explicit #4628
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
Conversation
Seems reasonable, yup. |
Looking good - linter failed on |
31c40e3
to
fc5a863
Compare
|
See the latest commit - added a section for non-field imports that are still public API. All of the non-field definitions: # fields.py
empty
is_simple_callable
get_attribute
set_value
to_choices_dict
flatten_choices_dict
iter_options
get_error_detail
CreateOnlyDefault
CurrentUserDefault
SkipField
REGEX_TYPE
NOT_READ_ONLY_WRITE_ONLY
NOT_READ_ONLY_REQUIRED
NOT_REQUIRED_DEFAULT
USE_READONLYFIELD
MISSING_ERROR_MESSAGE
# relations.py
method_overridden
Hyperlink
PKOnlyObject
MANY_RELATION_KWARGS From the above, serializers currently imports: # fields.py
empty
get_error_detail
set_value
CreateOnlyDefault
SkipField
# relations.py
Hyperlink
PKOnlyObject |
Great. Anyone else got thoughts/review on this? |
) | ||
|
||
def test_fields(self): | ||
msg = "Expected `fields.%s` to be imported in `serializers`" |
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.
These are great!
We are stuck on DRF 3.5.1 because on 3.5.2 this PR got merged encode/django-rest-framework#4628
This is a better approach to fixing the
from fields import *
inserializers
(see #4626/#4613).SkipField
,empty
, etc...)