countryScholarship.py 704 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 Scholarship, ScholarshipSerializer, ScholarshipViewSet
Florent Chehab's avatar
Florent Chehab committed
4
5
6
7
8
9


class CountryScholarship(Scholarship):
    country = models.ManyToManyField(
        Country, related_name="country_scholarhip")

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

Florent Chehab's avatar
Florent Chehab committed
14

15
class CountryScholarshipSerializer(ScholarshipSerializer):
Florent Chehab's avatar
Florent Chehab committed
16
17
18
19
20
21

    class Meta:
        model = CountryScholarship
        fields = '__all__'


22
class CountryScholarshipViewSet(ScholarshipViewSet):
Florent Chehab's avatar
Florent Chehab committed
23
24
    queryset = CountryScholarship.objects.all()  # pylint: disable=E1101
    serializer_class = CountryScholarshipSerializer