universityDri.py 724 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2
from backend.models.university import University
3
from backend.models.module import DriRestrictedModule, DriRestrictedModuleSerializer, DriRestrictedModuleViewSet
Florent Chehab's avatar
Florent Chehab committed
4
5
6
7
8
9


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

10
11
12
13
    @classmethod
    def get_serializer(cls):
        return UniversityDriSerializer

Florent Chehab's avatar
Florent Chehab committed
14
15
16
17
18
19
20
21

class UniversityDriSerializer(DriRestrictedModuleSerializer):

    class Meta:
        model = UniversityDri
        fields = '__all__'


22
class UniversityDriViewSet(DriRestrictedModuleViewSet):
Florent Chehab's avatar
Florent Chehab committed
23
24
    queryset = UniversityDri.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityDriSerializer