countryDri.py 685 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2
3
from backend.models.location import Country
from backend.models.module import DriRestrictedModule, DriRestrictedModuleSerializer
Florent Chehab's avatar
Florent Chehab committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from rest_framework import viewsets, permissions


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


class CountryDriSerializer(DriRestrictedModuleSerializer):

    class Meta:
        model = CountryDri
        fields = '__all__'


class CountryDriViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    queryset = CountryDri.objects.all()  # pylint: disable=E1101
    serializer_class = CountryDriSerializer