Complete star plugin implmentation on backend with database writes.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Mon, 10 Aug 2009 03:24:02 +0530
changeset 30 94fe7fe7394d
parent 29 425626c7f63e
child 31 ef9fdc847543
Complete star plugin implmentation on backend with database writes.
app/projrev/views/helpers/forms.py
app/projrev/views/proposal.py
app/templates/projrev/proposal/review.html
--- a/app/projrev/views/helpers/forms.py	Mon Aug 10 02:40:50 2009 +0530
+++ b/app/projrev/views/helpers/forms.py	Mon Aug 10 03:24:02 2009 +0530
@@ -30,6 +30,7 @@
     fields = ('line_item', 'institution', 'state', 
               'district', 'mobile_num', 'fax_num')
 
+
 class ReviewForm(forms.ModelForm):
   """Creates a form for review of proposal.
   """
--- a/app/projrev/views/proposal.py	Mon Aug 10 02:40:50 2009 +0530
+++ b/app/projrev/views/proposal.py	Mon Aug 10 03:24:02 2009 +0530
@@ -250,6 +250,8 @@
     # If the form is valid create a new project or update the project
     # if it already exists from the form.
     review = rev_form.save()
+    return HttpResponseRedirect(
+        reverse('app.projrev.views.proposal.rank', args=(micr_code,)))
 
   return reviewGet(request, micr_code, rev_form)
 
@@ -395,4 +397,14 @@
 
     return HttpResponse(json.dumps(dt_send))
 
-  return HttpResponse(None)
\ No newline at end of file
+  return HttpResponse(None)
+
+@access.register('reviewer')
+@access.checkAccess
+def listMyReviews(request):
+  """View function to list all reviews given by a user.
+  """
+  context = {}
+
+  template = ''
+  return render_to_response()
\ No newline at end of file
--- a/app/templates/projrev/proposal/review.html	Mon Aug 10 02:40:50 2009 +0530
+++ b/app/templates/projrev/proposal/review.html	Mon Aug 10 03:24:02 2009 +0530
@@ -1,6 +1,16 @@
 {% extends "projrev/base.html" %}
 {% load review_helpers %}
 
+{% block scripts %}
+{{ block.super }}
+<script type="text/javascript">
+$(document).ready(function () {
+  $('#attribute1').html();
+  
+}
+</script>
+{% endblock scripts %}
+
 {% block content %}
 <div class="post">
 			
@@ -113,91 +123,91 @@
       <p>
         {{ form.attribute1.errors }}
         {{ form.attribute1.label_tag }}
-        <input name="attribute1" type="radio" class="star"/>
-        <input name="attribute1" type="radio" class="star"/>
-        <input name="attribute1" type="radio" class="star"/>
-        <input name="attribute1" type="radio" class="star"/>
-        <input name="attribute1" type="radio" class="star"/> 
+        <input id="attribute1" name="attribute1" type="radio" class="star" value="1"/>
+        <input id="attribute1" name="attribute1" type="radio" class="star" value="2"/>
+        <input id="attribute1" name="attribute1" type="radio" class="star" value="3"/>
+        <input id="attribute1" name="attribute1" type="radio" class="star" value="4" />
+        <input id="attribute1" name="attribute1" type="radio" class="star" value="5"/> 
         {% if form.attribute1.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute2.errors }}
         {{ form.attribute2.label_tag }}
-        <input name="attribute2" type="radio" class="star"/>
-        <input name="attribute2" type="radio" class="star"/>
-        <input name="attribute2" type="radio" class="star"/>
-        <input name="attribute2" type="radio" class="star"/>
-        <input name="attribute2" type="radio" class="star"/> 
+        <input name="attribute2" type="radio" class="star" value="1"/>
+        <input name="attribute2" type="radio" class="star" value="2"/>
+        <input name="attribute2" type="radio" class="star" value="3"/>
+        <input name="attribute2" type="radio" class="star" value="4"/>
+        <input name="attribute2" type="radio" class="star" value="5"/> 
         {% if form.attribute2.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute3.errors }}
         {{ form.attribute3.label_tag }}
-        <input name="attribute3" type="radio" class="star"/>
-        <input name="attribute3" type="radio" class="star"/>
-        <input name="attribute3" type="radio" class="star"/>
-        <input name="attribute3" type="radio" class="star"/>
-        <input name="attribute3" type="radio" class="star"/> 
+        <input name="attribute3" type="radio" class="star" value="1"/>
+        <input name="attribute3" type="radio" class="star" value="2"/>
+        <input name="attribute3" type="radio" class="star" value="3"/>
+        <input name="attribute3" type="radio" class="star" value="4"/>
+        <input name="attribute3" type="radio" class="star" value="5"/> 
         {% if form.attribute3.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute4.errors }}
         {{ form.attribute4.label_tag }}
-        <input name="attribute4" type="radio" class="star"/>
-        <input name="attribute4" type="radio" class="star"/>
-        <input name="attribute4" type="radio" class="star"/>
-        <input name="attribute4" type="radio" class="star"/>
-        <input name="attribute4" type="radio" class="star"/> 
+        <input name="attribute4" type="radio" class="star" value="1"/>
+        <input name="attribute4" type="radio" class="star" value="2"/>
+        <input name="attribute4" type="radio" class="star" value="3"/>
+        <input name="attribute4" type="radio" class="star" value="4"/>
+        <input name="attribute4" type="radio" class="star" value="5"/> 
         {% if form.attribute4.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute5.errors }}
         {{ form.attribute5.label_tag }}
-        <input name="attribute5" type="radio" class="star"/>
-        <input name="attribute5" type="radio" class="star"/>
-        <input name="attribute5" type="radio" class="star"/>
-        <input name="attribute5" type="radio" class="star"/>
-        <input name="attribute5" type="radio" class="star"/> 
+        <input name="attribute5" type="radio" class="star" value="1"/>
+        <input name="attribute5" type="radio" class="star" value="2"/>
+        <input name="attribute5" type="radio" class="star" value="3"/>
+        <input name="attribute5" type="radio" class="star" value="4"/>
+        <input name="attribute5" type="radio" class="star" value="5"/> 
         {% if form.attribute5.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute6.errors }}
         {{ form.attribute6.label_tag }}
-        <input name="attribute6" type="radio" class="star"/>
-        <input name="attribute6" type="radio" class="star"/>
-        <input name="attribute6" type="radio" class="star"/>
-        <input name="attribute6" type="radio" class="star"/>
-        <input name="attribute6" type="radio" class="star"/> 
+        <input name="attribute6" type="radio" class="star" value="1"/>
+        <input name="attribute6" type="radio" class="star" value="2"/>
+        <input name="attribute6" type="radio" class="star" value="3"/>
+        <input name="attribute6" type="radio" class="star" value="4"/>
+        <input name="attribute6" type="radio" class="star" value="5"/> 
         {% if form.attribute6.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute7.errors }}
         {{ form.attribute7.label_tag }}
-        <input name="attribute7" type="radio" class="star"/>
-        <input name="attribute7" type="radio" class="star"/>
-        <input name="attribute7" type="radio" class="star"/>
-        <input name="attribute7" type="radio" class="star"/>
-        <input name="attribute7" type="radio" class="star"/> 
+        <input name="attribute7" type="radio" class="star" value="1"/>
+        <input name="attribute7" type="radio" class="star" value="2"/>
+        <input name="attribute7" type="radio" class="star" value="3"/>
+        <input name="attribute7" type="radio" class="star" value="4"/>
+        <input name="attribute7" type="radio" class="star" value="5"/> 
         {% if form.attribute7.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute8.errors }}
         {{ form.attribute8.label_tag }}
-        <input name="attribute8" type="radio" class="star"/>
-        <input name="attribute8" type="radio" class="star"/>
-        <input name="attribute8" type="radio" class="star"/>
-        <input name="attribute8" type="radio" class="star"/>
-        <input name="attribute8" type="radio" class="star"/> 
+        <input name="attribute8" type="radio" class="star" value="1"/>
+        <input name="attribute8" type="radio" class="star" value="2"/>
+        <input name="attribute8" type="radio" class="star" value="3"/>
+        <input name="attribute8" type="radio" class="star" value="4"/>
+        <input name="attribute8" type="radio" class="star" value="5"/> 
         {% if form.attribute8.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
       <p>
         {{ form.attribute9.errors }}
         {{ form.attribute9.label_tag }}
-        <input name="attribute9" type="radio" class="star"/>
-        <input name="attribute9" type="radio" class="star"/>
-        <input name="attribute9" type="radio" class="star"/>
-        <input name="attribute9" type="radio" class="star"/>
-        <input name="attribute9" type="radio" class="star"/> 
+        <input name="attribute9" type="radio" class="star" value="1"/>
+        <input name="attribute9" type="radio" class="star" value="2"/>
+        <input name="attribute9" type="radio" class="star" value="3"/>
+        <input name="attribute9" type="radio" class="star" value="4"/>
+        <input name="attribute9" type="radio" class="star" value="5"/> 
         {% if form.attribute9.field.required %}<span class="specialclass">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
 		<br />