universityBasicModules.py 3.55 KB
Newer Older
1
from django.db import models
2
from backend.models.module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
3
from backend.models.university import University
4

5
6
7
8
9
10
11
12
13
14

####################
# Insurance
###################


class UniversityInsurance(BasicModule):
    university = models.OneToOneField(
        University, on_delete=models.CASCADE, related_name='university_insurances', primary_key=True)

15
16
17
18
    @classmethod
    def get_serializer(cls):
        return UniversityInsuranceSerializer

19
20
21
22
23
24
25

class UniversityInsuranceSerializer(BasicModuleSerializer):
    class Meta:
        model = UniversityInsurance
        fields = '__all__'


26
class UniversityInsuranceViewSet(BasicModuleViewSet):
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    queryset = UniversityInsurance.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityInsuranceSerializer

#####################
#####################


####################
# Culture
###################

class UniversityCulture(BasicModule):
    university = models.OneToOneField(
        University, on_delete=models.CASCADE, related_name='university_culture', primary_key=True)

42
43
44
45
    @classmethod
    def get_serializer(cls):
        return UniversityCultureSerializer

46
47
48
49
50
51
52

class UniversityCultureSerializer(BasicModuleSerializer):
    class Meta:
        model = UniversityCulture
        fields = '__all__'


53
class UniversityCultureViewSet(BasicModuleViewSet):
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    queryset = UniversityCulture.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityCultureSerializer

#####################
#####################


####################
# Courses
###################

class UniversityCourses(BasicModule):
    university = models.OneToOneField(
        University, on_delete=models.CASCADE, related_name='university_courses', primary_key=True)

69
70
71
72
    @classmethod
    def get_serializer(cls):
        return UniversityCoursesSerializer

73
74
75
76
77
78
79

class UniversityCoursesSerializer(BasicModuleSerializer):
    class Meta:
        model = UniversityCourses
        fields = '__all__'


80
class UniversityCoursesViewSet(BasicModuleViewSet):
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    queryset = UniversityCourses.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityCoursesSerializer


#####################
#####################


####################
# SpecialOffer
###################
# TODO clarify this

class UniversitySpecialOffer(BasicModule):
    university = models.OneToOneField(
        University, on_delete=models.CASCADE, related_name='university_special_offer', primary_key=True)

98
99
100
101
    @classmethod
    def get_serializer(cls):
        return UniversitySpecialOfferSerializer

102
103
104
105
106
107
108

class UniversitySpecialOfferSerializer(BasicModuleSerializer):
    class Meta:
        model = UniversitySpecialOffer
        fields = '__all__'


109
class UniversitySpecialOfferViewSet(BasicModuleViewSet):
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
    queryset = UniversitySpecialOffer.objects.all()  # pylint: disable=E1101
    serializer_class = UniversitySpecialOfferSerializer


#####################
#####################


####################
# OtherStuff
###################

class UniversityOtherStuff(BasicModule):
    university = models.OneToOneField(
        University, on_delete=models.CASCADE, related_name='university_other_stuff', primary_key=True)

126
127
128
129
    @classmethod
    def get_serializer(cls):
        return UniversityOtherStuffSerializer

130
131
132
133
134
135
136

class UniversityOtherStuffSerializer(BasicModuleSerializer):
    class Meta:
        model = UniversityOtherStuff
        fields = '__all__'


137
class UniversityOtherStuffViewSet(BasicModuleViewSet):
138
139
    queryset = UniversityOtherStuff.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityOtherStuffSerializer