def get(self, request, *args, **kwargs): """Returns a list of environment by ids ou dict.""" only_main_property = True if not kwargs.get('environment_vip_id'): environments = facade.list_environment_environment_vip_related() else: env_id = kwargs.get('environment_vip_id') environments = facade.list_environment_environment_vip_related( env_id) # serializer environments serializer_env = serializers.EnvironmentV3Serializer( environments, many=True, fields=self.fields, include=self.include, exclude=self.exclude, kind=self.kind) # prepare serializer with customized properties data = render_to_json(serializer_env, main_property='environments', request=request, only_main_property=only_main_property) return Response(data, status=status.HTTP_200_OK)
def get(self, request, *args, **kwargs): """Returns a list of environment by ids ou dict.""" only_main_property = True if not kwargs.get('environment_vip_id'): environments = facade.list_environment_environment_vip_related() else: env_id = kwargs.get('environment_vip_id') environments = facade.list_environment_environment_vip_related( env_id) # serializer environments serializer_env = serializers.EnvironmentV3Serializer( environments, many=True, fields=self.fields, include=self.include, exclude=self.exclude, kind=self.kind ) # prepare serializer with customized properties data = render_to_json( serializer_env, main_property='environments', request=request, only_main_property=only_main_property ) return Response(data, status=status.HTTP_200_OK)