universityScholarship.py 781 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2

3 4 5 6 7
from backend_app.models.abstract.scholarship import (
    Scholarship,
    ScholarshipSerializer,
    ScholarshipViewSet,
)
8
from backend_app.models.university import University
Florent Chehab's avatar
Florent Chehab committed
9 10 11


class UniversityScholarship(Scholarship):
12
    universities = models.ManyToManyField(
13 14
        University, related_name="university_scholarships"
    )
Florent Chehab's avatar
Florent Chehab committed
15 16


17
class UniversityScholarshipSerializer(ScholarshipSerializer):
Florent Chehab's avatar
Florent Chehab committed
18 19
    class Meta:
        model = UniversityScholarship
20
        fields = "__all__"
Florent Chehab's avatar
Florent Chehab committed
21 22


23
class UniversityScholarshipViewSet(ScholarshipViewSet):
Florent Chehab's avatar
Florent Chehab committed
24 25
    queryset = UniversityScholarship.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityScholarshipSerializer
26 27
    end_point_route = "universityScholarships"
    filterset_fields = ("universities",)