countryBasicModules.py 4.88 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2
from backend.models.module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
3
from backend.models.location import Country
Florent Chehab's avatar
Florent Chehab committed
4
5
6
7
8
9
10
11
12
13


####################
# CountryVisaAdministrative
###################

class CountryVisaAdministrative(BasicModule):
    country = models.OneToOneField(
        Country, on_delete=models.CASCADE, related_name='country_visa_administrative', primary_key=True)

14
15
16
17
    @classmethod
    def get_serializer(cls):
        return CountryVisaAdministrativeSerializer

Florent Chehab's avatar
Florent Chehab committed
18
19
20
21
22
23
24

class CountryVisaAdministrativeSerializer(BasicModuleSerializer):
    class Meta:
        model = CountryVisaAdministrative
        fields = '__all__'


25
26
class CountryVisaAdministrativeViewSet(BasicModuleViewSet):

Florent Chehab's avatar
Florent Chehab committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
    queryset = CountryVisaAdministrative.objects.all()  # pylint: disable=E1101
    serializer_class = CountryVisaAdministrativeSerializer


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


####################
# CountryHealthInsurance
###################


class CountryHealthInsurance(BasicModule):
    country = models.OneToOneField(
        Country, on_delete=models.CASCADE, related_name='country_health_insurances', primary_key=True)

44
45
46
47
    @classmethod
    def get_serializer(cls):
        return CountryHealthInsuranceSerializer

Florent Chehab's avatar
Florent Chehab committed
48
49
50
51
52
53
54

class CountryHealthInsuranceSerializer(BasicModuleSerializer):
    class Meta:
        model = CountryHealthInsurance
        fields = '__all__'


55
56
class CountryHealthInsuranceViewSet(BasicModuleViewSet):

Florent Chehab's avatar
Florent Chehab committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
    queryset = CountryHealthInsurance.objects.all()  # pylint: disable=E1101
    serializer_class = CountryHealthInsuranceSerializer

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


####################
# Other Insurance
###################


class CountryOtherInsurance(BasicModule):
    country = models.OneToOneField(
        Country, on_delete=models.CASCADE, related_name='country_other_insurances', primary_key=True)

73
74
75
76
    @classmethod
    def get_serializer(cls):
        return CountryOtherInsuranceSerializer

Florent Chehab's avatar
Florent Chehab committed
77
78
79
80
81
82
83

class CountryOtherInsuranceSerializer(BasicModuleSerializer):
    class Meta:
        model = CountryOtherInsurance
        fields = '__all__'


84
85
class CountryOtherInsuranceViewSet(BasicModuleViewSet):

Florent Chehab's avatar
Florent Chehab committed
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
    queryset = CountryOtherInsurance.objects.all()  # pylint: disable=E1101
    serializer_class = CountryOtherInsuranceSerializer

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


####################
# CountryCulture
###################

class CountryCulture(BasicModule):
    country = models.OneToOneField(
        Country, on_delete=models.CASCADE, related_name='country_culture', primary_key=True)

101
102
103
104
    @classmethod
    def get_serializer(cls):
        return CountryCultureSerializer

Florent Chehab's avatar
Florent Chehab committed
105
106
107
108
109
110
111

class CountryCultureSerializer(BasicModuleSerializer):
    class Meta:
        model = CountryCulture
        fields = '__all__'


112
113
class CountryCultureViewSet(BasicModuleViewSet):

Florent Chehab's avatar
Florent Chehab committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
    queryset = CountryCulture.objects.all()  # pylint: disable=E1101
    serializer_class = CountryCultureSerializer

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


####################
# CountryTransport
###################

class CountryTransport(BasicModule):
    country = models.OneToOneField(
        Country, on_delete=models.CASCADE, related_name='country_transport', primary_key=True)

129
130
131
132
    @classmethod
    def get_serializer(cls):
        return CountryTransportSerializer

Florent Chehab's avatar
Florent Chehab committed
133
134
135
136
137
138
139

class CountryTransportSerializer(BasicModuleSerializer):
    class Meta:
        model = CountryTransport
        fields = '__all__'


140
141
class CountryTransportViewSet(BasicModuleViewSet):

Florent Chehab's avatar
Florent Chehab committed
142
143
144
145
146
147
148
149
    queryset = CountryTransport.objects.all()  # pylint: disable=E1101
    serializer_class = CountryTransportSerializer


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


Florent Chehab's avatar
Florent Chehab committed
150
151
152
153
154
155
156
157
####################
# CountryTourism
###################

class CountryTourism(BasicModule):
    country = models.OneToOneField(
        Country, on_delete=models.CASCADE, related_name='country_tourism', primary_key=True)

158
159
160
161
    @classmethod
    def get_serializer(cls):
        return CountryTourismSerializer

Florent Chehab's avatar
Florent Chehab committed
162
163
164
165
166
167
168

class CountryTourismSerializer(BasicModuleSerializer):
    class Meta:
        model = CountryTourism
        fields = '__all__'


169
170
class CountryTourismViewSet(BasicModuleViewSet):

Florent Chehab's avatar
Florent Chehab committed
171
172
173
174
175
176
177
178
    queryset = CountryTourism.objects.all()  # pylint: disable=E1101
    serializer_class = CountryTourismSerializer


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


Florent Chehab's avatar
Florent Chehab committed
179
180
181
182
183
184
185
186
####################
# CountryOtherStuff
###################

class CountryOtherStuff(BasicModule):
    country = models.OneToOneField(
        Country, on_delete=models.CASCADE, related_name='country_other_stuff', primary_key=True)

187
188
189
190
    @classmethod
    def get_serializer(cls):
        return CountryOtherStuffSerializer

Florent Chehab's avatar
Florent Chehab committed
191
192
193
194
195
196
197

class CountryOtherStuffSerializer(BasicModuleSerializer):
    class Meta:
        model = CountryOtherStuff
        fields = '__all__'


198
199
class CountryOtherStuffViewSet(BasicModuleViewSet):

Florent Chehab's avatar
Florent Chehab committed
200
201
    queryset = CountryOtherStuff.objects.all()  # pylint: disable=E1101
    serializer_class = CountryOtherStuffSerializer