mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Skip updating a subject if it already exists with the same year level, semester, and course postmigration
This commit is contained in:
parent
1c35e95f21
commit
84e33d7ca6
1 changed files with 3 additions and 0 deletions
|
@ -130,6 +130,9 @@ def populate_subjects(sender, **kwargs):
|
|||
if (Subject.objects.filter(name=subject_name).exists()):
|
||||
SUBJECT = Subject.objects.filter(name=subject_name
|
||||
).first()
|
||||
if (Subject.objects.filter(name=subject_name, year_levels=year_level, semesters=semester).exists()):
|
||||
# print('Duplicate subject')
|
||||
continue
|
||||
SUBJECT.courses.add(course)
|
||||
SUBJECT.year_levels.add(year_level)
|
||||
SUBJECT.semesters.add(semester)
|
||||
|
|
Loading…
Reference in a new issue