Skip to content

Commit

Permalink
fixed call to has_perm
Browse files Browse the repository at this point in the history
  • Loading branch information
brosner committed Dec 17, 2011
1 parent f78a1e9 commit ecfa0b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions agora/views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def forum(request, forum_id):
forum = get_object_or_404(Forum, id=forum_id) forum = get_object_or_404(Forum, id=forum_id)
threads = forum.threads.order_by("-sticky", "-last_modified") threads = forum.threads.order_by("-sticky", "-last_modified")


can_create_thread = request.user.has_perms("agora.add_forumthread", obj=forum) can_create_thread = request.user.has_perm("agora.add_forumthread", obj=forum)


return render_to_response("agora/forum.html", { return render_to_response("agora/forum.html", {
"forum": forum, "forum": forum,
Expand All @@ -77,7 +77,7 @@ def forum(request, forum_id):
def forum_thread(request, thread_id): def forum_thread(request, thread_id):
thread = get_object_or_404(ForumThread, id=thread_id) thread = get_object_or_404(ForumThread, id=thread_id)


can_create_reply = request.user.has_perms("agora.add_forumreply", obj=thread) can_create_reply = request.user.has_perm("agora.add_forumreply", obj=thread)


if request.user.is_authenticated() and not thread.closed and can_create_reply: if request.user.is_authenticated() and not thread.closed and can_create_reply:
if request.method == "POST": if request.method == "POST":
Expand Down Expand Up @@ -125,7 +125,7 @@ def post_create(request, forum_id):
member = request.user.get_profile() member = request.user.get_profile()
forum = get_object_or_404(Forum, id=forum_id) forum = get_object_or_404(Forum, id=forum_id)


can_create_thread = request.user.has_perms("agora.add_forumthread", obj=forum) can_create_thread = request.user.has_perm("agora.add_forumthread", obj=forum)


if not can_create_thread: if not can_create_thread:
messages.error(request, "You do not have permission to create a thread.") messages.error(request, "You do not have permission to create a thread.")
Expand Down Expand Up @@ -168,7 +168,7 @@ def reply_create(request, thread_id):
if thread.closed: if thread.closed:
messages.error(request, "This thread is closed.") messages.error(request, "This thread is closed.")


can_create_reply = request.user.has_perms("agora.add_forumreply", obj=thread) can_create_reply = request.user.has_perm("agora.add_forumreply", obj=thread)


if not can_create_reply: if not can_create_reply:
messages.error(request, "You do not have permission to reply to this thread.") messages.error(request, "You do not have permission to reply to this thread.")
Expand Down

0 comments on commit ecfa0b2

Please sign in to comment.