【发布时间】:2017-10-20 19:19:52
【问题描述】:
文档在这里:http://www.django-rest-framework.org/api-guide/views/#get_permissionsself
在此示例中,格式设置为无但不引用它:
class ListUsers(APIView):
"""
View to list all users in the system.
* Requires token authentication.
* Only admin users are able to access this view.
"""
authentication_classes = (authentication.TokenAuthentication,)
permission_classes = (permissions.IsAdminUser,)
def get(self, request, format=None):
"""
Return a list of all users.
"""
usernames = [user.username for user in User.objects.all()]
return Response(usernames)
我检查了源代码,仍然没有提到格式。
欣赏一些清晰
【问题讨论】:
标签: django django-rest-framework