querystring validation ok
This commit is contained in:
parent
3636d4a72b
commit
b94c058598
@ -86,9 +86,10 @@ class IssueSerializer(ModelSerializer):
|
|||||||
|
|
||||||
class CommentListSerializer(ModelSerializer):
|
class CommentListSerializer(ModelSerializer):
|
||||||
|
|
||||||
|
issue = IssueSerializer(many=False)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Comment
|
model = Comment
|
||||||
fields = ['title', 'date_created', 'author']
|
fields = ['title', 'date_created', 'author', 'issue']
|
||||||
|
|
||||||
class CommentDetailSerializer(ModelSerializer):
|
class CommentDetailSerializer(ModelSerializer):
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ from rest_framework.permissions import (IsAuthenticated,
|
|||||||
IsAuthenticatedOrReadOnly)
|
IsAuthenticatedOrReadOnly)
|
||||||
from support.permissions import IsAuthor, IsContributor
|
from support.permissions import IsAuthor, IsContributor
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
|
from rest_framework.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class ProjectViewSet(ModelViewSet):
|
class ProjectViewSet(ModelViewSet):
|
||||||
@ -65,6 +66,8 @@ class IssueViewSet(ModelViewSet):
|
|||||||
|
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
#check for the right query string or return nothing
|
||||||
|
if self.request.GET.get('project'):
|
||||||
project_id = int(self.request.GET.get('project'))
|
project_id = int(self.request.GET.get('project'))
|
||||||
project = Project.objects.get(id=project_id)
|
project = Project.objects.get(id=project_id)
|
||||||
self.check_object_permissions(self.request, project)
|
self.check_object_permissions(self.request, project)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user