universityBasicModules.py 3.1 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
15
16
17
18
19
20
21

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


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


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


22
class UniversityInsuranceViewSet(BasicModuleViewSet):
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    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)


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


45
class UniversityCultureViewSet(BasicModuleViewSet):
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
    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)


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


68
class UniversityCoursesViewSet(BasicModuleViewSet):
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
    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)


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


93
class UniversitySpecialOfferViewSet(BasicModuleViewSet):
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
    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)


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


117
class UniversityOtherStuffViewSet(BasicModuleViewSet):
118
119
    queryset = UniversityOtherStuff.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityOtherStuffSerializer