Fix login for users with no school class

This commit is contained in:
Ramon Wenger 2020-03-10 11:03:06 +01:00
parent 394469d773
commit b3b02acfef
1 changed files with 2 additions and 0 deletions

View File

@ -56,6 +56,8 @@ class UserNode(DjangoObjectType):
return self.is_teacher()
def resolve_school_classes(self, info):
if self.selected_class() is None: # then we don't have any class to return
return []
return SchoolClass.objects.filter(
Q(schoolclassmember__active=True, schoolclassmember__user=self) | Q(pk=self.selected_class().pk)).distinct()