Fix error on attempting to view

This commit is contained in:
Yingtong Li 2019-02-09 23:13:03 +11:00
parent 9ce8af1200
commit 64ed052acf
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -42,7 +42,7 @@ class Group(models.Model):
return True return True
for email in self.managers: for email in self.managers:
manager = User.objects.get(email=email) manager = User.objects.get(email=email)
if user.email in manager.delegates: if hasattr(manager, 'userprofile') and user.email in manager.userprofile.delegates:
return True return True
return False return False
@ -96,7 +96,7 @@ class BulletinItem(models.Model):
return True return True
if user == self.author: if user == self.author:
return True return True
if user.email in self.author.delegates: if hasattr(self.author, 'userprofile') and user.email in self.author.userprofile.delegates:
return True return True
return False return False