user can be none

This commit is contained in:
j 2018-01-15 12:16:20 +01:00
parent 046c49cd3b
commit 2a0c2acc97
2 changed files with 2 additions and 2 deletions

View File

@ -122,7 +122,7 @@ class Collection(models.Model):
return self.user == user or self.status in ('public', 'featured')
def editable(self, user):
if user.is_anonymous():
if not user or user.is_anonymous():
return False
if self.user == user or \
self.groups.filter(id__in=user.groups.all()).count() > 0 or \

View File

@ -115,7 +115,7 @@ class List(models.Model):
return self.user == user or self.status in ('public', 'featured')
def editable(self, user):
if user.is_anonymous():
if not user or user.is_anonymous():
return False
if self.user == user or \
self.groups.filter(id__in=user.groups.all()).count() > 0 or \