countryScholarship.py 708 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 Scholarship, BasicModuleSerializer
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 CountryScholarship(Scholarship):
    country = models.ManyToManyField(
        Country, related_name="country_scholarhip")


class CountryScholarshipSerializer(BasicModuleSerializer):

    class Meta:
        model = CountryScholarship
        fields = '__all__'


class CountryScholarshipViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    queryset = CountryScholarship.objects.all()  # pylint: disable=E1101
    serializer_class = CountryScholarshipSerializer