diff --git a/apps/authentication/models.py b/apps/authentication/models.py index 6e7c2b8d9..cb4ded701 100644 --- a/apps/authentication/models.py +++ b/apps/authentication/models.py @@ -68,8 +68,9 @@ def is_member(self): """ Returns true if the User object is associated with Online. """ - if AllowedUsername.objects.filter(username=self.ntnu_username.lower()).filter(expiration_date__gte=timezone.now()).count() > 0: - return True + if self.ntnu_username: + if AllowedUsername.objects.filter(username=self.ntnu_username.lower()).filter(expiration_date__gte=timezone.now()).count() > 0: + return True return False def get_full_name(self):