run host listing through v1 vs. v2 logic

* api/v1/hosts related fields were getting v2 in the related urls. The
context is now included in the serializer instantiation.
This commit is contained in:
Chris Meyers 2017-04-17 11:43:44 -04:00
parent 4b537870b4
commit 775093294e

View File

@ -1714,8 +1714,8 @@ class HostList(ListCreateAPIView):
try:
queryset = self.get_queryset()
except Exception as e:
return Response(dict(error=_(unicode(e))), status=status.HTTP_400_BAD_REQUEST)
return Response(dict(results=self.serializer_class(queryset, many=True).data))
return Response(dict(error=_(unicode(e))), context=self.get_serializer_context(), status=status.HTTP_400_BAD_REQUEST)
return Response(dict(results=self.serializer_class(queryset, many=True, context=self.get_serializer_context()).data))
class HostDetail(RetrieveUpdateDestroyAPIView):