Added relationship between subjects and student

This commit is contained in:
Keannu Christian Bernasol 2023-04-11 23:20:01 +08:00
parent ac0f4b5e28
commit 5182dfa8da
9 changed files with 148 additions and 48 deletions

View file

@ -0,0 +1,34 @@
# Generated by Django 4.2 on 2023-04-11 15:10
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('students', '0003_remove_student_enrolled_subjects'),
('subjects', '0003_subject_semester'),
]
operations = [
migrations.RemoveField(
model_name='subject',
name='enrolled_count',
),
migrations.CreateModel(
name='SubjectStudent',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
('student_assigned', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='students.student')),
('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.subject')),
],
),
migrations.AddField(
model_name='subject',
name='students',
field=models.ManyToManyField(related_name='SubjectStudent_student_assigned', through='subjects.SubjectStudent', to='students.student'),
),
]