2021-03-29 14:24:58 +00:00
|
|
|
# Copyright (C) 2020 by Animath
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
from django_filters.rest_framework import DjangoFilterBackend
|
|
|
|
from rest_framework.viewsets import ModelViewSet
|
|
|
|
|
2024-03-23 10:36:09 +00:00
|
|
|
from .serializers import PaymentSerializer, RegistrationSerializer
|
|
|
|
from ..models import Payment, Registration
|
2021-03-29 14:24:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RegistrationViewSet(ModelViewSet):
|
|
|
|
queryset = Registration.objects.all()
|
|
|
|
serializer_class = RegistrationSerializer
|
|
|
|
filter_backends = [DjangoFilterBackend]
|
|
|
|
filterset_fields = ['user', 'participantregistration__team', ]
|
2024-03-23 10:36:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PaymentViewSet(ModelViewSet):
|
|
|
|
queryset = Payment.objects.all()
|
|
|
|
serializer_class = PaymentSerializer
|
|
|
|
filter_backends = [DjangoFilterBackend]
|
|
|
|
filterset_fields = ['registrations', 'grouped', 'amount', 'final', 'type', 'valid', ]
|