Skip to content

Add actions parameter to ViewSetMixin.as_view. #18

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
merged 2 commits into from
Aug 16, 2019
Merged

Add actions parameter to ViewSetMixin.as_view. #18

merged 2 commits into from
Aug 16, 2019

Conversation

cs-cordero
Copy link
Contributor

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution!
Just one question from me.

@@ -11,7 +11,7 @@ class ViewSetMixin(object):
basename: str
request: Any
@classmethod
def as_view(cls, **initkwargs: Any) -> Callable: ...
def as_view(cls, actions: Optional[Dict[str, Any]] = None, **initkwargs: Any) -> Callable: ...
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it Optional[Dict[str, str]]?

Why str, str?
Searching trough the docs gave me this impression: https://github.com/encode/django-rest-framework/blob/master/rest_framework/viewsets.py#L6

Can you please point to any other use-cases?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it seems that it's a mapping between http method and method name on the class, it should be Dict[str, str] or maybe Mapping[str, str] to be a bit more general.

Choose a reason for hiding this comment

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

@mkurnikov Mapping could be unnecessarily broad. IMO the type should be Dict[str, str] unless someone explicitly requests to change it.

@@ -11,7 +11,7 @@ class ViewSetMixin(object):
basename: str
request: Any
@classmethod
def as_view(cls, **initkwargs: Any) -> Callable: ...
def as_view(cls, actions: Optional[Dict[str, Any]] = None, **initkwargs: Any) -> Callable: ...

Choose a reason for hiding this comment

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

@mkurnikov Mapping could be unnecessarily broad. IMO the type should be Dict[str, str] unless someone explicitly requests to change it.

@mkurnikov mkurnikov merged commit 85547a8 into typeddjango:master Aug 16, 2019
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.

4 participants