def get(self, request, pk, format=None): categories = categorization_service.get_categories() filtered_categories = filter(lambda c: ("%s" % c.pk) == pk, categories) if len(filtered_categories) == 0: filtered_categories = filter(lambda c: c.alias == pk, categories) if len(filtered_categories) == 0: return sz_api_response.Response(status=status.HTTP_404_NOT_FOUND) serializer = serializers.CategorySerializer(instance=filtered_categories[0]) return sz_api_response.Response(serializer.data)
def get(self, request, format=None): categories = categorization_service.get_categories() serializer = serializers.CategorySerializer(instance=categories) return sz_api_response.Response(serializer.data)