Skip to content

Commit 7a110df

Browse files
authored
fix: non school teachers can now save levels (#1767)
1 parent 4b847ce commit 7a110df

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

game/views/level_editor.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,14 @@ def save_level_for_editor(request, levelId=None):
263263

264264
# share with all admins of the school if user is in a school
265265
if not is_user_independent:
266-
school_admins = teacher.school.admins()
267-
268-
[
269-
level.shared_with.add(school_admin.new_user)
270-
for school_admin in school_admins
271-
if school_admin.new_user != request.user
272-
]
266+
if not teacher.school is None:
267+
school_admins = teacher.school.admins()
268+
269+
[
270+
level.shared_with.add(school_admin.new_user)
271+
for school_admin in school_admins
272+
if school_admin.new_user != request.user
273+
]
273274

274275
level.save()
275276
response = {"id": level.id}

0 commit comments

Comments
 (0)