mirror of
https://github.com/lemeow125/InfoTech-Backend.git
synced 2024-11-16 22:19:25 +08:00
Fixed serializer field for subject on ScheduleSerializer
This commit is contained in:
parent
23a4a4a190
commit
864643278c
1 changed files with 4 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
from rest_framework import serializers
|
||||
from .models import Schedule
|
||||
from professors.models import Professor
|
||||
from subjects.models import Subject
|
||||
from students.models import Student
|
||||
|
||||
|
||||
|
@ -14,6 +15,9 @@ class ScheduleSerializer(serializers.HyperlinkedModelSerializer):
|
|||
professor = serializers.SlugRelatedField(
|
||||
queryset=Professor.objects.all(), slug_field='full_name', allow_null=True)
|
||||
|
||||
subject = serializers.SlugRelatedField(
|
||||
queryset=Subject.objects.all(), slug_field='code', allow_null=True)
|
||||
|
||||
class Meta:
|
||||
model = Schedule
|
||||
fields = ('id', 'subject', 'students_assigned',
|
||||
|
|
Loading…
Reference in a new issue