4848 QueueStatistic ,
4949 Semester ,
5050 Tag ,
51- Booking ,
5251)
5352from ohq .pagination import QuestionSearchPagination
5453from ohq .permissions import (
6665 QueuePermission ,
6766 QueueStatisticPermission ,
6867 TagPermission ,
69- BookingPermission ,
7068)
7169from ohq .schemas import EventSchema , MassInviteSchema , OccurrenceSchema
7270from ohq .serializers import (
8583 SemesterSerializer ,
8684 TagSerializer ,
8785 UserPrivateSerializer ,
88- BookingSerializer ,
8986)
9087from ohq .sms import sendSMSVerification
9188
@@ -746,15 +743,15 @@ class OccurrenceViewSet(
746743 You must specify all of the fields or use a patch request.
747744
748745 partial_update:
749- Update certain fields in the Occurrence .
746+ Update certain fields in the Occurrece .
750747 """
751748
752749 serializer_class = OccurrenceSerializer
753750 permission_classes = [OccurrencePermission | IsSuperuser ]
754751 schema = OccurrenceSchema ()
755752
756753 def list (self , request , * args , ** kwargs ):
757- # ensure timezone consistency
754+ # ensure timezone consitency
758755 course_ids = request .GET .getlist ("course" )
759756 filter_start = datetime .strptime (
760757 request .GET .get ("filter_start" ), "%Y-%m-%dT%H:%M:%SZ"
@@ -780,60 +777,6 @@ def list(self, request, *args, **kwargs):
780777
781778 def get_queryset (self ):
782779 return Occurrence .objects .filter (pk = self .kwargs ["pk" ])
783-
784- class BookingDetailViewSet (
785- mixins .RetrieveModelMixin ,
786- mixins .UpdateModelMixin ,
787- mixins .DestroyModelMixin ,
788- viewsets .GenericViewSet ,
789- ):
790- """
791- retrieve:
792- Return a single booking.
793-
794- update:
795- Update all fields in the booking.
796- You must specify all of the fields or use a patch request.
797-
798- partial_update:
799- Update certain fields in the booking.
800- Only specify the fields that you want to change.
801-
802- destroy:
803- Delete a booking.
804- """
805-
806- serializer_class = BookingSerializer
807- permission_classes = [BookingPermission | IsSuperuser ]
808-
809- def get_queryset (self ):
810- return Booking .objects .filter (pk = self .kwargs ["pk" ])
811-
812- class BookingListCreateViewSet (
813- mixins .ListModelMixin ,
814- mixins .CreateModelMixin ,
815- viewsets .GenericViewSet ,
816- ):
817- """
818- list:
819- Return a list of bookings for a specific occurrence.
820-
821- create:
822- Create a booking for a specific occurrence.
823- """
824-
825- serializer_class = BookingSerializer
826- permission_classes = [BookingPermission | IsSuperuser ]
827-
828- def get_queryset (self ):
829- occurrence_id = self .kwargs .get ("occurrence_pk" )
830- return Booking .objects .filter (occurrence = occurrence_id ).order_by ("start" )
831-
832- def perform_create (self , serializer ):
833- occurrence_id = self .kwargs .get ("occurrence_pk" )
834- occurrence = Occurrence .objects .get (pk = occurrence_id )
835- serializer .save (occurrence = occurrence , user = self .request .user )
836-
837780class HealthView (View ):
838781 def get (self , request ):
839782 """
@@ -852,4 +795,4 @@ def get(self, request):
852795 enum: ["OK"]
853796 ---
854797 """
855- return JsonResponse ({"message" : "OK" }, status = HTTPStatus .OK )
798+ return JsonResponse ({"message" : "OK" }, status = HTTPStatus .OK )
0 commit comments