Skip to content

More precise *Field arguments and instance attributes #62

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

Merged

Conversation

intgr
Copy link
Contributor

@intgr intgr commented Jan 29, 2020

Field constructors are quite inconsistent in Django REST Framework: some take position arguments, some don't. Some pass positional arguments to their parent class, others pass only keyword arguments. It took a while but I sorted through all the constructors and nailed down the precise behavior.

The stubs did not previously denote keyword-only arguments, and the order of positional arguments was slightly wrong in many places.

Also, added many instance attributes of *Field classes that were missing.

@intgr intgr force-pushed the more-precise-field-args-and-attrs branch from d8929f7 to a7a1cd4 Compare January 30, 2020 22:04
@intgr
Copy link
Contributor Author

intgr commented Jan 30, 2020

Pushed a small update, I found that ChoiceField.choices is actually a property that's always an OrderedDict.

@intgr intgr force-pushed the more-precise-field-args-and-attrs branch from a7a1cd4 to 1a7ba2b Compare January 30, 2020 22:11
Field constructors are quite inconsistent in Django REST Framework: some
take position arguments, some don't. Some pass positional arguments to
their parent class, others pass only keyword arguments. It took a while
but I sorted through all the constructors and nailed down the precise
behavior.

The stubs did not previously denote keyword-only arguments, and the
order of positional arguments was slightly wrong in many places.

Also, added many instance attributes of *Field classes that were
missing.
@intgr intgr force-pushed the more-precise-field-args-and-attrs branch from 1a7ba2b to 9305a50 Compare January 30, 2020 22:55
@sobolevn
Copy link
Member

Thanks!

@sobolevn sobolevn merged commit 2112425 into typeddjango:master Jan 30, 2020
@intgr
Copy link
Contributor Author

intgr commented Jan 30, 2020

Thanks too, working on TypedDjango projects has been pleasant. :)

@kalekseev kalekseev mentioned this pull request Apr 8, 2020
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.

2 participants