universityScholarship.py 767 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2
3
from backend.models.university import University
from backend.models.module import Scholarship, BasicModuleSerializer
Florent Chehab's avatar
Florent Chehab committed
4
from rest_framework import viewsets, permissions
Florent Chehab's avatar
Florent Chehab committed
5
6
7


class UniversityScholarship(Scholarship):
Florent Chehab's avatar
Florent Chehab committed
8
9
10
11
    university = models.ForeignKey(
        University, on_delete=models.PROTECT, null=False, related_name="univScholarship")


Florent Chehab's avatar
Florent Chehab committed
12
class UniversityScholarshipSerializer(BasicModuleSerializer):
Florent Chehab's avatar
Florent Chehab committed
13
14
15

    class Meta:
        model = UniversityScholarship
Florent Chehab's avatar
Florent Chehab committed
16
        fields = '__all__'
Florent Chehab's avatar
Florent Chehab committed
17
18
19
20
21
22


class UniversityScholarshipViewSet(viewsets.ModelViewSet):
    permission_classes = (permissions.DjangoModelPermissions,)
    queryset = UniversityScholarship.objects.all()  # pylint: disable=E1101
    serializer_class = UniversityScholarshipSerializer