mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Fixed integrity issues with on_delete for customuser
This commit is contained in:
parent
9196bfa602
commit
f6cbe1941e
5 changed files with 58 additions and 4 deletions
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 4.2.2 on 2023-07-04 10:04
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('semesters', '0001_initial'),
|
||||
('courses', '0002_initial'),
|
||||
('year_levels', '0001_initial'),
|
||||
('accounts', '0003_customuser_subjects'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customuser',
|
||||
name='course',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='courses.course'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customuser',
|
||||
name='semester',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='semesters.semester'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customuser',
|
||||
name='year_level',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='year_levels.year_level'),
|
||||
),
|
||||
]
|
|
@ -41,17 +41,17 @@ class CustomUser(AbstractUser):
|
|||
avatar = models.ImageField(upload_to=_get_upload_to, null=True)
|
||||
course = models.ForeignKey(
|
||||
Course,
|
||||
on_delete=models.CASCADE,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True
|
||||
)
|
||||
year_level = models.ForeignKey(
|
||||
Year_Level,
|
||||
on_delete=models.CASCADE,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True
|
||||
)
|
||||
semester = models.ForeignKey(
|
||||
Semester,
|
||||
on_delete=models.CASCADE,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True
|
||||
)
|
||||
subjects = models.ManyToManyField(
|
||||
|
|
|
@ -182,3 +182,5 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
DOMAIN = 'stude://'
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 4.2.2 on 2023-07-04 10:01
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('subjects', '0002_subjectstudent_subject_students'),
|
||||
('student_status', '0004_alter_studentstatus_study_group'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='studentstatus',
|
||||
name='subject',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='subjects.subject'),
|
||||
),
|
||||
]
|
|
@ -11,7 +11,7 @@ class StudentStatus(models.Model):
|
|||
x = models.FloatField(null=True)
|
||||
y = models.FloatField(null=True)
|
||||
subject = models.ForeignKey(
|
||||
'subjects.Subject', on_delete=models.CASCADE, null=True)
|
||||
'subjects.Subject', on_delete=models.SET_NULL, null=True)
|
||||
active = models.BooleanField(default=False)
|
||||
timestamp = models.DateField(auto_now_add=True)
|
||||
study_group = models.ManyToManyField(
|
||||
|
|
Loading…
Reference in a new issue