File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def get_projects_for_detail_view(self):
4747 )
4848
4949 def get_projects_for_count_view (self ):
50- return self .get_queryset ().filter (draft = False ).only ("id" )
50+ return self .get_queryset ().filter (draft = False ).only ("id" , "leader_id" )
5151
5252 def check_if_owns_any_projects (self , user ) -> bool :
5353 # I don't think this should work but the function has no usages, so I'll let it be
Original file line number Diff line number Diff line change @@ -81,7 +81,13 @@ class ProjectCountView(generics.GenericAPIView):
8181 permission_classes = [permissions .IsAuthenticatedOrReadOnly ]
8282
8383 def get (self , request ):
84- return Response ({"count" : self .get_queryset ().count ()}, status = status .HTTP_200_OK )
84+ return Response (
85+ {
86+ "all" : self .get_queryset ().count (),
87+ "my" : self .get_queryset ().filter (leader_id = request .user .id ).count (),
88+ },
89+ status = status .HTTP_200_OK ,
90+ )
8591
8692
8793class ProjectCollaborators (generics .GenericAPIView ):
You can’t perform that action at this time.
0 commit comments