mirror of
https://github.com/lemeow125/InfoTech-Backend.git
synced 2025-05-16 11:28:14 +08:00
Polished name field for schedule model
This commit is contained in:
parent
00c8e6f4f4
commit
716b7cf348
4 changed files with 29 additions and 7 deletions
|
@ -1,12 +1,14 @@
|
|||
from django.shortcuts import get_object_or_404
|
||||
from rest_framework import serializers
|
||||
from django.contrib.auth.models import User
|
||||
from .models import Student
|
||||
from schedules.models import Schedule
|
||||
from subjects.models import Subject
|
||||
|
||||
|
||||
class StudentSerializer(serializers.HyperlinkedModelSerializer):
|
||||
schedules = serializers.SlugRelatedField(
|
||||
queryset=Schedule.objects.all(), slug_field='schedule_subject', allow_null=True)
|
||||
queryset=Subject.objects.all(), slug_field='name', allow_null=True)
|
||||
|
||||
class Meta:
|
||||
model = Student
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue