mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Make sure APIRoot.get can take on args, kwargs so router can be embedded within any URL pattern.
This commit is contained in:
parent
d4d7739574
commit
1a885b9e16
|
@ -284,10 +284,10 @@ class DefaultRouter(SimpleRouter):
|
|||
class APIRoot(views.APIView):
|
||||
_ignore_model_permissions = True
|
||||
|
||||
def get(self, request, format=None):
|
||||
def get(self, request, *args, **kwargs):
|
||||
ret = {}
|
||||
for key, url_name in api_root_dict.items():
|
||||
ret[key] = reverse(url_name, request=request, format=format)
|
||||
ret[key] = reverse(url_name, request=request, format=kwargs.get('format', None))
|
||||
return Response(ret)
|
||||
|
||||
return APIRoot.as_view()
|
||||
|
|
Loading…
Reference in New Issue
Block a user