Fixed the correct redirects and review saves.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Thu, 13 Aug 2009 03:42:34 +0530
changeset 46 e27c75dedbfb
parent 45 9ffe957d6159
child 47 09c3b7aaa535
Fixed the correct redirects and review saves.
app/projrev/views/proposal.py
app/templates/projrev/proposal/review_list.html
--- a/app/projrev/views/proposal.py	Thu Aug 13 03:26:45 2009 +0530
+++ b/app/projrev/views/proposal.py	Thu Aug 13 03:42:34 2009 +0530
@@ -233,11 +233,13 @@
 def reviewPost(request, micr_code=None, review_id=None):
   """
   """
-
-  if review_id:
+  is_new = request.GET.get('new')
+  if review_id and is_new != '0':
+    redirect = False
     review_instance = Review.objects.get(id=review_id)
     rev_form = projrev_forms.ReviewForm(request.POST, instance=review_instance)
   else:
+    redirect = True
     rev_form = projrev_forms.ReviewForm(request.POST)
 
   if rev_form.is_valid():
@@ -253,8 +255,9 @@
     # 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,)))
+
+    if redirect:
+      return HttpResponseRedirect(reverse('app.projrev.views.proposal.review', args=(micr_code, review.id)))
 
   return reviewGet(request, micr_code, review_id, rev_form)
 
--- a/app/templates/projrev/proposal/review_list.html	Thu Aug 13 03:26:45 2009 +0530
+++ b/app/templates/projrev/proposal/review_list.html	Thu Aug 13 03:42:34 2009 +0530
@@ -21,7 +21,7 @@
       <div class='hidden' style="display: none;">
         <div id='message_{{ project.project|serial_no:"new" }}' style='padding:10px; background:#fff;'>
           This proposal is revised after you submitted a review. You will have to submit a new review to the revised proposal. Press the relevant button.<br />
-          <a href='{{ row_url }}{{ project.project.micr_code }}/{{ project.user_review.id }}'>Start with my previous review</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+          <a href='{{ row_url }}{{ project.project.micr_code }}/{{ project.user_review.id }}?new=0'>Start with my previous review</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <a href='{{ row_url }}{{ project.project.micr_code }}'>Start a fresh review</a>
         </div>
       </div>