universityDri.py 717 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2
3
from backend.models.university import University
from backend.models.module import DriRestrictedModule, DriRestrictedModuleSerializer
Florent Chehab's avatar
Florent Chehab committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from rest_framework import viewsets, permissions


class UniversityDri(DriRestrictedModule):
    university = models.ManyToManyField(
        University, related_name="university_dri")


class UniversityDriSerializer(DriRestrictedModuleSerializer):

    class Meta:
        model = UniversityDri
        fields = '__all__'


class UniversityDriViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    queryset = UniversityDri.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityDriSerializer