mirror of
https://github.com/lemeow125/InfoTech-Backend.git
synced 2024-11-16 22:19:25 +08:00
Made schedules field in students not required
This commit is contained in:
parent
44a81dc6fe
commit
73df769a4a
2 changed files with 20 additions and 1 deletions
19
infotech/students/migrations/0012_alter_student_schedules.py
Normal file
19
infotech/students/migrations/0012_alter_student_schedules.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -8,7 +8,7 @@ from subjects.models import Subject
|
||||||
|
|
||||||
class StudentSerializer(serializers.HyperlinkedModelSerializer):
|
class StudentSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
schedules = serializers.SlugRelatedField(
|
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:
|
class Meta:
|
||||||
model = Student
|
model = Student
|
||||||
|
|
Loading…
Reference in a new issue