Support Django path
in ViewSet decorator action
#8126
Answered
by
browniebroke
amchii
asked this question in
Ideas & Suggestions
-
Django's class UserViewSet(viewsets.ViewSet):
@action(methods=['GET'], detail=True, url_path="collections/<int:collection_id>/blogs")
# @action(methods=['GET'], detail=True, url_path="collections/(?P<collection_id>[0-9]+)/blogs")
def get_collected_blogs(self, request, pk=None, collection_id=None, **kwargs):
return Response(status=status.HTTP_200_OK) |
Beta Was this translation helpful? Give feedback.
Answered by
browniebroke
Sep 10, 2024
Replies: 1 comment
-
I think that was added in #6789 (released in DRF 3.15 earlier this year) You need to set it at the router level: - my_router = SimpleRouter()
+ my_router = SimpleRouter(use_regex_path=False) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tomchristie
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think that was added in #6789 (released in DRF 3.15 earlier this year)
You need to set it at the router level: