Request context.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Thu, 06 Aug 2009 19:10:03 +0530
changeset 6 17cab73c49eb
parent 5 88ae12bc6280
child 7 3e6916eb3d2c
Request context.
app/projrev/views/helpers/forms.py
app/projrev/views/proposal.py
app/templates/projrev/base.html
--- a/app/projrev/views/helpers/forms.py	Thu Aug 06 18:38:54 2009 +0530
+++ b/app/projrev/views/helpers/forms.py	Thu Aug 06 19:10:03 2009 +0530
@@ -6,6 +6,7 @@
   '"Madhusudan.C.S" <madhusudancs@gmail.com>',
 ]
 
+
 from django import forms
 
 from projrev.models import Project
--- a/app/projrev/views/proposal.py	Thu Aug 06 18:38:54 2009 +0530
+++ b/app/projrev/views/proposal.py	Thu Aug 06 19:10:03 2009 +0530
@@ -14,16 +14,15 @@
 from django.core.urlresolvers import reverse
 from django.http import HttpResponseRedirect
 from django.shortcuts import render_to_response, get_object_or_404
+from django.template import RequestContext
 
 from projrev.models import Project
 from projrev.models import Proposal
 from projrev.views.helpers import access 
 from projrev.views.helpers import forms as projrev_forms
 
-rights = {}
-rights['getMicr'] = 'proposer'
 
-
+@access.checkAccess
 def getMicr(request):
   """View to get MICR Code from the user.
   """
@@ -46,7 +45,8 @@
             context = {
                 'error': True,
                 }
-            return render_to_response(template, context)
+            return render_to_response(template,
+                                      RequestContext(request, context))
         else:
           if submit == 'Edit Proposal for MICR Code':
             return HttpResponseRedirect(
@@ -60,8 +60,10 @@
     template = 'projrev/proposal/get_micr.html'
     context = {}
 
-    return render_to_response(template, context)
+    return render_to_response(template, RequestContext(request, context))
 
+
+@access.checkAccess
 def submit(request, micr_code=None):
   """View for proposal submission.
   """
@@ -160,8 +162,9 @@
 
   template = 'projrev/proposal/submit.html'
 
-  return render_to_response(template, context)
+  return render_to_response(template, RequestContext(request, context))
 
+@access.checkAccess
 def withdraw(request, micr_code=None):
   """View Method for withdrawal of proposal.
   """
@@ -177,8 +180,9 @@
 
   template = 'projrev/proposal/withdraw.html'
 
-  return render_to_response(template, context)
+  return render_to_response(template, RequestContext(request, context))
 
+@access.checkAccess
 def review(request, micr_code=None):
   """View for reviewing the proposal.
   """
@@ -216,7 +220,7 @@
         'row_url': '/proposal/review/',
         }
 
-    return render_to_response(template, context)
+    return render_to_response(template, RequestContext(request, context))
 
   if not rev_form:
     rev_form = projrev_forms.ReviewForm()
@@ -235,8 +239,9 @@
 
   template = 'projrev/proposal/review.html'
 
-  return render_to_response(template, context)
+  return render_to_response(template, RequestContext(request, context))
 
+@access.checkAccess
 def rank(request, micr_code=None):
   """
   """
@@ -263,7 +268,7 @@
         'row_url': '/proposal/rank/',
         }
 
-    return render_to_response(template, context)
+    return render_to_response(template, RequestContext(request, context))
 
   projects = Project.objects.get(micr_code=micr_code)
 
@@ -297,4 +302,4 @@
 
   template = 'projrev/proposal/rank.html'
 
-  return render_to_response(template, context)
+  return render_to_response(template, RequestContext(request, context))
--- a/app/templates/projrev/base.html	Thu Aug 06 18:38:54 2009 +0530
+++ b/app/templates/projrev/base.html	Thu Aug 06 19:10:03 2009 +0530
@@ -54,8 +54,14 @@
 
 			<div class="sidebox">	
 			
-				<h1>Sponsors</h1>
+				<h1>Links</h1>
 				<ul class="sidemenu">
+				  {% if user.is_authenticated %}
+    <p>Welcome, {{ user.username }}. Thanks for logging in.</p>
+{% else %}
+    <p>Welcome, new user. Please log in.</p>
+{% endif %}
+				  
 					<li><a href="http://www.dreamhost.com/r.cgi?287326" class="top">Dreamhost</a></li>
 					<li><a href="http://www.4templates.com/?aff=ealigam">4templates</a></li>
 					<li><a href="http://store.templatemonster.com/?aff=ealigam">TemplateMonster</a></li>