Don't try to return a serializer if there is no request object. Used when the API view is being introspected.
Signed-off-by: Michael Price <loneviking72@gmail.com>
This commit is contained in:
committed by
Roberto Rosario
parent
f8cb63b11a
commit
afd4748426
@@ -45,6 +45,12 @@ class APICommentListView(generics.ListCreateAPIView):
|
||||
def get_queryset(self):
|
||||
return self.get_document().comments.all()
|
||||
|
||||
def get_serializer(self, *args, **kwargs):
|
||||
if not self.request:
|
||||
return None
|
||||
|
||||
return super(APICommentListView, self).get_serializer(*args, **kwargs)
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.request.method == 'GET':
|
||||
return CommentSerializer
|
||||
|
||||
Reference in New Issue
Block a user