From 0a23049a4c850c00b97e24b739f9278983d01f53 Mon Sep 17 00:00:00 2001 From: melwil Date: Tue, 26 Nov 2013 23:31:04 +0100 Subject: [PATCH] Fixed a bug where ntnu_username was empty and methods were being called on it. --- apps/authentication/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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):