# HG changeset patch # User Nishanth Amuluru # Date 1294771947 -19800 # Node ID 32dd15eaf9d0cdfe6bd598c75706618557ae374b # Parent 026f2059a97a5c28ac036b45b97f5517323bcb37 fixed a bug where guest users were not able to view the page correctly diff -r 026f2059a97a -r 32dd15eaf9d0 pytask/taskapp/views.py --- a/pytask/taskapp/views.py Wed Jan 12 00:19:22 2011 +0530 +++ b/pytask/taskapp/views.py Wed Jan 12 00:22:27 2011 +0530 @@ -449,30 +449,33 @@ textbook = getTextBook(tid) textbook_url = "/task/textbook/view/tid=%s"%textbook.uniq_key + chapters = textbook.chapters.all() user = request.user + + context = {"user": user, + "textbook": textbook, + "chapters": chapters, + } + if not user.is_authenticated(): - return render_to_response("task/view_textbook.html", {"user": user}) + return render_to_response("task/view_textbook.html", context) profile = user.get_profile() - context = {"user": user, - "profile": profile, - "textbook": textbook, - } + context.update({"profile": profile, + "textbook": textbook, + }) context.update(csrf(request)) - chapters = Task.objects.filter(status="UP") - can_edit = True if user == textbook.created_by and textbook.status == "UP"\ else False can_approve = True if profile.rights in ["MG", "DC"] and \ textbook.status == "UP" else False - context.update({"chapters": chapters, - "can_edit": can_edit, + context.update({"can_edit": can_edit, "can_approve": can_approve}) return render_to_response("task/view_textbook.html", context)