forked from extern/django-helpdesk
Create FollowUpAttachment serializer + handle attachment in TicketSerializer and in FollowUpSerializer in order to attach directly one or multiple attachments to the created followup.
This commit is contained in:
@@ -4,8 +4,8 @@ from rest_framework.viewsets import GenericViewSet
|
||||
from rest_framework.mixins import CreateModelMixin
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
from helpdesk.models import Ticket, FollowUp
|
||||
from helpdesk.serializers import TicketSerializer, UserSerializer, FollowUpSerializer
|
||||
from helpdesk.models import Ticket, FollowUp, FollowUpAttachment
|
||||
from helpdesk.serializers import TicketSerializer, UserSerializer, FollowUpSerializer, FollowUpAttachmentSerializer
|
||||
|
||||
|
||||
class TicketViewSet(viewsets.ModelViewSet):
|
||||
@@ -29,14 +29,17 @@ class TicketViewSet(viewsets.ModelViewSet):
|
||||
|
||||
|
||||
class FollowUpViewSet(viewsets.ModelViewSet):
|
||||
"""
|
||||
A viewset that provides the standard actions to handle FollowUp
|
||||
"""
|
||||
queryset = FollowUp.objects.all()
|
||||
serializer_class = FollowUpSerializer
|
||||
permission_classes = [IsAdminUser]
|
||||
|
||||
|
||||
class FollowUpAttachmentViewSet(viewsets.ModelViewSet):
|
||||
queryset = FollowUpAttachment.objects.all()
|
||||
serializer_class = FollowUpAttachmentSerializer
|
||||
permission_classes = [IsAdminUser]
|
||||
|
||||
|
||||
class CreateUserView(CreateModelMixin, GenericViewSet):
|
||||
queryset = get_user_model().objects.all()
|
||||
serializer_class = UserSerializer
|
||||
|
Reference in New Issue
Block a user