semester.py 657 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
Florent Chehab's avatar
Florent Chehab committed
2
3
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
Florent Chehab's avatar
Florent Chehab committed
4
5


6
class Semester(MyModel):
Florent Chehab's avatar
Florent Chehab committed
7
    model_config = get_model_config("Semester")
Florent Chehab's avatar
Florent Chehab committed
8
9
10
    code = models.CharField(primary_key=True, max_length=6)


11
class SemesterSerializer(MyModelSerializer):
Florent Chehab's avatar
Florent Chehab committed
12
13
14
15
16
    class Meta:
        model = Semester
        fields = '__all__'


17
class SemesterViewSet(MyModelViewSet):
18
    permission_classes = get_viewset_permissions("SemesterViewSet")
Florent Chehab's avatar
Florent Chehab committed
19
20
    queryset = Semester.objects.all()  # pylint: disable=E1101
    serializer_class = SemesterSerializer