SMART-52 implementation of retrieve user's projects endpoint

This commit is contained in:
s460930 2020-12-15 16:33:28 +01:00
parent c3a50e0552
commit b313e583dc
2 changed files with 5 additions and 0 deletions

Binary file not shown.

View File

@ -6,6 +6,7 @@ from rest_framework.permissions import IsAuthenticated
from rest_framework.viewsets import ModelViewSet from rest_framework.viewsets import ModelViewSet
from smartpicasso.app.project.serializers import ProjectSerializer from smartpicasso.app.project.serializers import ProjectSerializer
from smartpicasso.app.project.models import Project
class ProjectsView(ModelViewSet): class ProjectsView(ModelViewSet):
@ -17,3 +18,7 @@ class ProjectsView(ModelViewSet):
def perform_create(self, serializer): def perform_create(self, serializer):
serializer.save(user=self.request.user) serializer.save(user=self.request.user)
def get_queryset(self):
user = self.request.user
return Project.objects.filter(user=user)