countryBasicModules.py 4.26 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
from django.db import models
from rex.models.module import BasicModule
from rex.models.location import Country
from rest_framework import viewsets, permissions
from rex.models.module import BasicModuleSerializer


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

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


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


# TODO switch to dict
class CountryVisaAdministrativeViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    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)


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


# TODO switch to dict
class CountryHealthInsuranceViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    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)


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


# TODO switch to dict
class CountryOtherInsuranceViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    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)


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


class CountryCultureViewSet(viewsets.ModelViewSet):  # TODO switch to dict
    permission_classes = (permissions.DjangoModelPermissions,)
    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)


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


class CountryTransportViewSet(viewsets.ModelViewSet):  # TODO switch to dict
    permission_classes = (permissions.DjangoModelPermissions,)
    queryset = CountryTransport.objects.all()  # pylint: disable=E1101
    serializer_class = CountryTransportSerializer


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


####################
# CountryOtherStuff
###################

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


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


# TODO switch to dict
class CountryOtherStuffViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    queryset = CountryOtherStuff.objects.all()  # pylint: disable=E1101
    serializer_class = CountryOtherStuffSerializer