mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Fixed statement for study group moving
This commit is contained in:
parent
7b5e84c400
commit
0e41c30347
1 changed files with 1 additions and 1 deletions
|
@ -68,7 +68,7 @@ class StudentStatusSerializer(serializers.ModelSerializer):
|
|||
old_study_group.delete()
|
||||
|
||||
# If student has changed study group, check if the old study_group no longer has any students
|
||||
if study_group is not old_study_group and old_study_group is not None:
|
||||
if study_group is not None and study_group is not old_study_group and old_study_group is not None:
|
||||
if not old_study_group.students.exists():
|
||||
# If there are no students left in the old StudyGroup, delete it
|
||||
old_study_group.delete()
|
||||
|
|
Loading…
Reference in a new issue