countryDri.py 689 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2
from backend.models.location import Country
3
from backend.models.module import DriRestrictedModule, DriRestrictedModuleSerializer, DriRestrictedModuleViewSet
Florent Chehab's avatar
Florent Chehab committed
4
5
6
7
8
9


class CountryDri(DriRestrictedModule):
    country = models.ManyToManyField(
        Country, related_name="country_dri")

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

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

class CountryDriSerializer(DriRestrictedModuleSerializer):

    class Meta:
        model = CountryDri
        fields = '__all__'


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