Make sure APIRoot.get can take on args, kwargs so router can be embedded within any URL pattern.

This commit is contained in:
Gaurav Dadhania 2014-09-09 05:42:52 +05:30
parent d4d7739574
commit 1a885b9e16

View File

@ -284,10 +284,10 @@ class DefaultRouter(SimpleRouter):
class APIRoot(views.APIView): class APIRoot(views.APIView):
_ignore_model_permissions = True _ignore_model_permissions = True
def get(self, request, format=None): def get(self, request, *args, **kwargs):
ret = {} ret = {}
for key, url_name in api_root_dict.items(): 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 Response(ret)
return APIRoot.as_view() return APIRoot.as_view()