Commit 8a589bbc by benjaoming

Merge branch 'master' of github.com:benjaoming/django-wiki

parents 3a31f2ce c7aa2e17
......@@ -57,7 +57,7 @@ class Article(models.Model):
if user == self.owner:
return True
if self.group_read:
if self.group and user.groups.filter(id=self.group.id):
if self.group and user.groups.filter(id=self.group.id).exists():
return True
if self.can_moderate(user):
return True
......@@ -74,7 +74,7 @@ class Article(models.Model):
if user == self.owner:
return True
if self.group_write:
if self.group and user and user.groups.filter(id=self.group.id):
if self.group and user and user.groups.filter(id=self.group.id).exists():
return True
if self.can_moderate(user):
return True
......
......@@ -60,6 +60,8 @@ class URLPath(MPTTModel):
If the cached ancestors were not set explicitly, they will be retrieved from
the database.
"""
if not self.get_ancestors().exists():
self._cached_ancestors = []
if not hasattr(self, "_cached_ancestors"):
self._cached_ancestors = list(self.get_ancestors().select_related_common() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment