universityDri.py 781 Bytes
Newer Older
1
from django.db import models
2

3
from backend_app.models.abstract.module import Module, ModuleSerializer, ModuleViewSet
4 5
from backend_app.models.university import University
from backend_app.permissions.app_permissions import IsStaff, IsDri, ReadOnly
6 7


8
class UniversityDri(Module):
9
    universities = models.ManyToManyField(University, related_name="university_dri")
10 11


12
class UniversityDriSerializer(ModuleSerializer):
13 14
    class Meta:
        model = UniversityDri
15
        fields = "__all__"
16 17


18
class UniversityDriViewSet(ModuleViewSet):
19 20
    queryset = UniversityDri.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityDriSerializer
21
    permission_classes = (IsStaff | IsDri | ReadOnly,)
22 23
    end_point_route = "universityDri"
    filterset_fields = ("universities",)