File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616urlpatterns = [
1717 path ("" , ProjectList .as_view ()),
18- path ("<int:pk>/collaborators" , ProjectCollaborators .as_view ()),
18+ path ("<int:pk>/collaborators/ " , ProjectCollaborators .as_view ()),
1919 path ("<int:pk>/" , ProjectDetail .as_view ()),
2020 path ("count/" , ProjectCountView .as_view ()),
2121 path ("steps/" , ProjectSteps .as_view ()),
Original file line number Diff line number Diff line change 22from rest_framework import generics , permissions , status
33from rest_framework .response import Response
44from rest_framework .views import APIView
5-
5+ from django . db . models import Q
66from core .permissions import IsStaffOrReadOnly
77from projects .filters import ProjectFilter
88from projects .helpers import VERBOSE_STEPS
@@ -98,13 +98,15 @@ class ProjectCountView(generics.GenericAPIView):
9898 serializer_class = ProjectListSerializer
9999 # TODO: using this permission could result in a user not having verified email
100100 # creating a project; probably should make IsUserVerifiedOrReadOnly
101- permission_classes = [permissions .IsAuthenticatedOrReadOnly ]
101+ permission_classes = [permissions .IsAuthenticated ]
102102
103103 def get (self , request ):
104104 return Response (
105105 {
106106 "all" : self .get_queryset ().filter (draft = False ).count (),
107- "my" : self .get_queryset ().filter (leader_id = request .user .id ).count (),
107+ "my" : self .get_queryset ()
108+ .filter (Q (leader_id = request .user .id ) | Q (collaborator__user = request .user ))
109+ .count (),
108110 },
109111 status = status .HTTP_200_OK ,
110112 )
You can’t perform that action at this time.
0 commit comments