Browse Source

Remove unused CommentListDoc API

pull/1649/head
Hironsan 2 years ago
parent
commit
9bd8758643
2 changed files with 0 additions and 22 deletions
  1. 5
      backend/api/urls.py
  2. 17
      backend/api/views/comment.py

5
backend/api/urls.py

@ -115,11 +115,6 @@ urlpatterns_project = [
view=tag.TagDetail.as_view(),
name='tag_detail'
),
path(
route='examples/<int:example_id>/comments',
view=comment.CommentListDoc.as_view(),
name='comment_list_doc'
),
path(
route='comments',
view=comment.CommentList.as_view(),

17
backend/api/views/comment.py

@ -10,23 +10,6 @@ from ..permissions import IsOwnComment
from ..serializers import CommentSerializer
class CommentListDoc(generics.ListCreateAPIView):
pagination_class = None
permission_classes = [IsAuthenticated & IsInProjectOrAdmin]
serializer_class = CommentSerializer
model = Comment
def get_queryset(self):
queryset = self.model.objects.filter(
example__project_id=self.kwargs['project_id'],
example=self.kwargs['example_id']
)
return queryset
def perform_create(self, serializer):
serializer.save(example_id=self.kwargs['example_id'], user=self.request.user)
class CommentList(generics.ListCreateAPIView):
permission_classes = [IsAuthenticated & IsInProjectOrAdmin]
serializer_class = CommentSerializer

Loading…
Cancel
Save