File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 22from django .db .models .manager import BaseManager
33from rest_framework import generics
44from rest_framework .response import Response
5- from rest_framework .renderers import JSONRenderer
5+ from rest_framework .exceptions import NotFound
6+
67from rest_framework_json_api .serializers import ResourceIdentifierObjectSerializer
78from rest_framework_json_api .utils import format_relation_name , get_resource_type_from_instance
8- from rest_framework .exceptions import NotFound
99
1010
1111class RelationshipView (generics .GenericAPIView ):
1212 serializer_class = ResourceIdentifierObjectSerializer
13- renderer_classes = (JSONRenderer , )
1413
1514 def get (self , request , * args , ** kwargs ):
1615 related_instance = self .get_related_instance ()
@@ -40,7 +39,7 @@ def get_related_instance(self):
4039 raise NotFound
4140
4241 def _instantiate_serializer (self , instance ):
43- if isinstance (instance , Model ):
42+ if isinstance (instance , Model ) or instance is None :
4443 return self .get_serializer (instance = instance )
4544 else :
4645 if isinstance (instance , (QuerySet , BaseManager )):
You can’t perform that action at this time.
0 commit comments