Admin users can manage juries
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
50d8bc2aed
commit
64b7644e5e
|
@ -4,7 +4,7 @@
|
|||
from django.contrib.auth.models import User
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from rest_framework.filters import SearchFilter
|
||||
from rest_framework.permissions import BasePermission, IsAuthenticated, SAFE_METHODS
|
||||
from rest_framework.permissions import BasePermission, IsAdminUser, IsAuthenticated, SAFE_METHODS
|
||||
from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet
|
||||
|
||||
from .serializers import BasicUserSerializer, PaymentSerializer, RegistrationSerializer
|
||||
|
@ -34,7 +34,7 @@ class IsTournamentOrganizer(BasePermission):
|
|||
class VolunteersViewSet(ReadOnlyModelViewSet):
|
||||
queryset = User.objects.filter(registration__volunteerregistration__isnull=False)
|
||||
serializer_class = BasicUserSerializer
|
||||
permission_classes = [IsAuthenticated & IsTournamentOrganizer]
|
||||
permission_classes = [IsAdminUser | (IsAuthenticated & IsTournamentOrganizer)]
|
||||
filter_backends = [DjangoFilterBackend, SearchFilter]
|
||||
filterset_fields = ['first_name', 'last_name', 'email', ]
|
||||
search_fields = ['$first_name', '$last_name', '$email', ]
|
||||
|
|
Loading…
Reference in New Issue