def category_detail(request, category_id):
"""
Category detail
---
serializer: categories.serializers.CategorySerializer
responseMessages:
- code: 400
message: Bad request.
- code: 401
message: Unauthorized. Authentication credentials were not provided. Invalid token.
- code: 403
message: Forbidden.
- code: 404
message: Not found
"""
category = get_object_or_404(Category, pk=category_id)
if request.method == 'GET':
serializer = CategorySerializer(category)
return Response(serializer.data, status=status.HTTP_200_OK)
评论列表
文章目录