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

Add more attribute to fields, fixes #31 #32

Closed
wants to merge 1 commit into from

Conversation

kalekseev
Copy link
Contributor

Fixes #31, this will give type errors when user defined field name clash with one of the attributes eg.:

class MySerializer(Serializer):
    label = CharField()

but it seems like mypy don't provide a way to distinguish class attrs and instance vars python/mypy#1097

Similar issue #12 marked as won't fix.

@@ -67,10 +79,10 @@ class Field:
source: Union[Callable, str] = ...,
label: Optional[str] = ...,
help_text: str = ...,
allow_null: bool = ...,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reordered kwargs to repeat drf order

@kalekseev
Copy link
Contributor Author

tests on master fail with the same error on my machine

@kalekseev kalekseev force-pushed the patch-fields branch 3 times, most recently from 30cbc59 to 144ad00 Compare October 19, 2019 09:58
@sobolevn sobolevn requested a review from mkurnikov October 19, 2019 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Typings for Field attributes
1 participant