MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / get_queryset

Method get_queryset

api/projects/views.py:87–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

85 return super().get_serializer_context()
86
87 def get_queryset(self): # type: ignore[no-untyped-def]
88 if getattr(self, "swagger_fake_view", False):
89 return Project.objects.none()
90
91 queryset = self.request.user.get_permitted_projects(permission_key=VIEW_PROJECT) # type: ignore[union-attr]
92
93 organisation_id = self.request.query_params.get("organisation")
94 if organisation_id:
95 try:
96 int(organisation_id)
97 except (TypeError, ValueError):
98 raise ValidationError({"organisation": "Must be a valid integer."})
99 queryset = queryset.filter(organisation__id=organisation_id)
100
101 project_uuid = self.request.query_params.get("uuid")
102 if project_uuid:
103 queryset = queryset.filter(uuid=project_uuid)
104
105 return queryset
106
107 def perform_create(self, serializer): # type: ignore[no-untyped-def]
108 project = serializer.save()

Callers 1

get_by_uuidMethod · 0.95

Calls 2

getMethod · 0.45

Tested by

no test coverage detected