예제 #1
0
파일: events.py 프로젝트: estensen/lego
class EventAdministrateSerializer(EventReadSerializer):
    pools = PoolAdministrateSerializer(many=True)
    unregistered = RegistrationReadDetailedSerializer(many=True)
    waiting_registrations = RegistrationReadDetailedSerializer(many=True)

    class Meta(EventReadSerializer.Meta):
        fields = EventReadSerializer.Meta.fields + ('pools', 'unregistered',
                                                    'waiting_registrations')
예제 #2
0
class EventAdministrateSerializer(EventReadSerializer):
    pools = PoolAdministrateSerializer(many=True)
    unregistered = RegistrationReadDetailedSerializer(many=True)
    waiting_registrations = RegistrationReadDetailedSerializer(many=True)

    class Meta(EventReadSerializer.Meta):
        fields = EventReadSerializer.Meta.fields + (
            "pools",
            "unregistered",
            "waiting_registrations",
            "use_consent",
        )
예제 #3
0
파일: views.py 프로젝트: mklarz/lego
    def admin_unregister(self, request, *args, **kwargs):
        admin_user = request.user
        event_id = self.kwargs.get("event_pk", None)
        event = Event.objects.get(id=event_id)
        serializer = self.get_serializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        try:
            registration = event.admin_unregister(
                admin_user=admin_user, **serializer.validated_data
            )
            if (
                registration.payment_intent_id
                and registration.payment_status != constants.PAYMENT_SUCCESS
            ):
                async_cancel_payment.delay(registration.id)
            notify_event_registration(
                constants.SOCKET_UNREGISTRATION_SUCCESS, registration
            )
        except NoSuchRegistration:
            raise APINoSuchRegistration()
        except RegistrationExists:
            raise APIRegistrationExists()
        reg_data = RegistrationReadDetailedSerializer(registration).data

        return Response(data=reg_data, status=status.HTTP_200_OK)
예제 #4
0
파일: views.py 프로젝트: vhellem/lego
 def admin_unregister(self, request, *args, **kwargs):
     event_id = self.kwargs.get('event_pk', None)
     event = Event.objects.get(id=event_id)
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     try:
         registration = event.admin_unregister(**serializer.validated_data)
     except NoSuchRegistration:
         raise APINoSuchRegistration()
     except RegistrationExists:
         raise APIRegistrationExists()
     reg_data = RegistrationReadDetailedSerializer(registration).data
     return Response(data=reg_data, status=status.HTTP_200_OK)
예제 #5
0
 def admin_register(self, request, *args, **kwargs):
     event_id = self.kwargs.get("event_pk", None)
     try:
         event = Event.objects.get(id=event_id)
     except Event.DoesNotExist:
         raise APIEventNotFound()
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     try:
         registration = event.admin_register(**serializer.validated_data)
     except NoSuchPool:
         raise APINoSuchPool()
     except RegistrationExists:
         raise APIRegistrationExists()
     reg_data = RegistrationReadDetailedSerializer(registration).data
     return Response(data=reg_data, status=status.HTTP_201_CREATED)
예제 #6
0
class PoolAdministrateSerializer(PoolReadAuthSerializer):
    registrations = RegistrationReadDetailedSerializer(many=True)