Commit ea26ab85 by benjaoming

Anonymous users cannot be used in queries!

parent c619639c
...@@ -8,6 +8,9 @@ class PermissionArticleManagerMixin(object): ...@@ -8,6 +8,9 @@ class PermissionArticleManagerMixin(object):
are included""" are included"""
if user.has_perm('wiki.moderator'): if user.has_perm('wiki.moderator'):
return self.get_query_set() return self.get_query_set()
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 = self.get_query_set().filter(Q(other_read=True) |
Q(owner=user) | Q(owner=user) |
(Q(group__user=user) & Q(group_read=True)) (Q(group__user=user) & Q(group_read=True))
...@@ -19,6 +22,9 @@ class PermissionArticleManagerMixin(object): ...@@ -19,6 +22,9 @@ class PermissionArticleManagerMixin(object):
are included""" are included"""
if user.has_perm('wiki.moderator'): if user.has_perm('wiki.moderator'):
return self.get_query_set() return self.get_query_set()
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 = self.get_query_set().filter(Q(other_write=True) |
Q(owner=user) | Q(owner=user) |
(Q(group__user=user) & Q(group_write=True)) (Q(group__user=user) & Q(group_write=True))
......
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
<div class="tab-content"> <div class="tab-content">
<div class="row-fluid"> <div class="row-fluid">
<div class="span7"> <div class="span7">
<h2>{% trans "Attachments" %}</h2> <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>
<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>
{% for attachment in attachments %} {% for attachment in attachments %}
<table class="table table-bordered table-striped" style="width: 100%;"> <table class="table table-bordered table-striped" style="width: 100%;">
<tr> <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