Skip to content
Snippets Groups Projects
Select Git revision
  • 7dba5527f21bdc9af24e19b502ae2d6d592e7b32
  • renovate/django-split-settings-1.x
  • renovate/djangorestframework-3.x
  • main
  • 520-improve-trackmanager
  • 520-fix-scheduling
  • 520-akowner
  • 520-status
  • 520-message-resolved
  • 520-improve-scheduling-2
  • renovate/django-bootstrap5-24.x
  • 520-improve-submission
  • 520-improve-scheduling
  • 520-improve-wall
  • 520-fix-event-wizard-datepicker
  • 520-upgrades
  • renovate/tzdata-2023.x
  • renovate/django-5.x
  • renovate/fontawesomefree-6.x
  • renovate/sphinx-rtd-theme-2.x
  • renovate/sphinxcontrib-apidoc-0.x
21 results

apps.py

Blame
  • Forked from KIF / AKPlanning
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    api.py 2.92 KiB
    from rest_framework import mixins, viewsets, permissions
    
    from AKModel.metaviews.admin import EventSlugMixin
    from AKModel.models import AKOwner, AKCategory, AKTrack, AK, Room, AKSlot
    from AKModel.serializers import AKOwnerSerializer, AKCategorySerializer, AKTrackSerializer, AKSerializer, \
        RoomSerializer, AKSlotSerializer
    
    
    class AKOwnerViewSet(EventSlugMixin, mixins.RetrieveModelMixin, mixins.ListModelMixin, viewsets.GenericViewSet):
        """
        API View: Owners (restricted to those of the given event)
        Read-only
        """
        permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
        serializer_class = AKOwnerSerializer
    
        def get_queryset(self):
            return AKOwner.objects.filter(event=self.event)
    
    
    class AKCategoryViewSet(EventSlugMixin, mixins.RetrieveModelMixin, mixins.ListModelMixin, viewsets.GenericViewSet):
        """
        API View: Categories (restricted to those of the given event)
        Read-only
        """
        permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
        serializer_class = AKCategorySerializer
    
        def get_queryset(self):
            return AKCategory.objects.filter(event=self.event)
    
    
    class AKTrackViewSet(EventSlugMixin, mixins.RetrieveModelMixin, mixins.CreateModelMixin, mixins.UpdateModelMixin,
                         mixins.DestroyModelMixin, mixins.ListModelMixin, viewsets.GenericViewSet):
        """
        API View: Tracks (restricted to those of the given event)
        Read, Write, Delete
        """
        permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
        serializer_class = AKTrackSerializer
    
        def get_queryset(self):
            return AKTrack.objects.filter(event=self.event)
    
    
    class AKViewSet(EventSlugMixin, mixins.RetrieveModelMixin, mixins.UpdateModelMixin, mixins.ListModelMixin,
                    viewsets.GenericViewSet):
        """
        API View: AKs (restricted to those of the given event)
        Read, Write
        """
        permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
        serializer_class = AKSerializer
    
        def get_queryset(self):
            return AK.objects.filter(event=self.event)
    
    
    class RoomViewSet(EventSlugMixin, mixins.RetrieveModelMixin, mixins.ListModelMixin, viewsets.GenericViewSet):
        """
        API View: Rooms (restricted to those of the given event)
        Read-only
        """
        permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
        serializer_class = RoomSerializer
    
        def get_queryset(self):
            return Room.objects.filter(event=self.event)
    
    
    class AKSlotViewSet(EventSlugMixin, mixins.RetrieveModelMixin, mixins.CreateModelMixin, mixins.UpdateModelMixin,
                        mixins.ListModelMixin, viewsets.GenericViewSet):
        """
        API View: AK slots (restricted to those of the given event)
        Read, Write
        """
        permission_classes = (permissions.DjangoModelPermissionsOrAnonReadOnly,)
        serializer_class = AKSlotSerializer
    
        def get_queryset(self):
            return AKSlot.objects.filter(event=self.event)