Commit ea26ab85 by benjaoming

Anonymous users cannot be used in queries!

parent c619639c
......@@ -8,10 +8,13 @@ class PermissionArticleManagerMixin(object):
are included"""
if user.has_perm('wiki.moderator'):
return self.get_query_set()
q = self.get_query_set().filter(Q(other_read=True) |
Q(owner=user) |
(Q(group__user=user) & Q(group_read=True))
)
if user.is_anonymous():
q = self.get_query_set().filter(other_read=True)
else:
q = self.get_query_set().filter(Q(other_read=True) |
Q(owner=user) |
(Q(group__user=user) & Q(group_read=True))
)
return q
def can_write(self, user):
......@@ -19,10 +22,13 @@ class PermissionArticleManagerMixin(object):
are included"""
if user.has_perm('wiki.moderator'):
return self.get_query_set()
q = self.get_query_set().filter(Q(other_write=True) |
Q(owner=user) |
(Q(group__user=user) & Q(group_write=True))
)
if user.is_anonymous():
q = self.get_query_set().filter(other_write=True)
else:
q = self.get_query_set().filter(Q(other_write=True) |
Q(owner=user) |
(Q(group__user=user) & Q(group_write=True))
)
return q
class PermissionArticleManager(PermissionArticleManagerMixin, models.Manager):
......
......@@ -24,8 +24,7 @@
<div class="tab-content">
<div class="row-fluid">
<div class="span7">
<h2>{% trans "Attachments" %}</h2>
<p>{% trans "The following files are available for this article. Copy the markdown tag to directly refer to a file from the article text." %}</p>
<p class="lead">{% trans "The following files are available for this article. Copy the markdown tag to directly refer to a file from the article text." %}</p>
{% for attachment in attachments %}
<table class="table table-bordered table-striped" style="width: 100%;">
<tr>
......
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