Made schedules field in students not required

This commit is contained in:
keannu125 2023-04-22 17:07:14 +08:00
parent 44a81dc6fe
commit 73df769a4a
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,19 @@
# Generated by Django 4.2 on 2023-04-22 08:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('schedules', '0007_schedule_semester'),
('students', '0011_student_schedules'),
]
operations = [
migrations.AlterField(
model_name='student',
name='schedules',
field=models.ManyToManyField(null=True, related_name='StudentSchedule_subject', through='schedules.StudentSchedule', to='schedules.schedule'),
),
]

View file

@ -8,7 +8,7 @@ from subjects.models import Subject
class StudentSerializer(serializers.HyperlinkedModelSerializer):
schedules = serializers.SlugRelatedField(
queryset=Subject.objects.all(), many=True, slug_field='name', allow_null=True)
queryset=Subject.objects.all(), many=True, slug_field='name', allow_null=True, required=False)
class Meta:
model = Student