changeset 201:c2a1c8950db2

Added code for Ratings Module to snippets template file
author Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com>
date Fri, 19 Jul 2013 21:55:04 +0500
parents 49cda19bff99
children 499e5f47f278
files templates/snippet/snippet_details.djhtml
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/templates/snippet/snippet_details.djhtml	Fri Jul 19 21:51:16 2013 +0500
+++ b/templates/snippet/snippet_details.djhtml	Fri Jul 19 21:55:04 2013 +0500
@@ -74,6 +74,9 @@
             Language: {{ language }}
             &mdash;
             Number of views: {{ snippet.num_views }}
+            {%  load ratings %}
+            Total Votes: {{ snippet.rating.votes }}
+            Rating: {{ score }}
         </div>
     </div><!-- closes .snippet-options -->
     <br />
@@ -81,6 +84,16 @@
     {% include "snippet/snippet_box.djhtml" with lines=snippet.content_splitted %}
 
     <br />
+    <div id = "radio_votes">
+
+              <form action = "rating/process/"  method = "POST" id="rate_form">
+              {% csrf_token%}
+              <h3 id ="rate_label">Rate this Snippet:</h3>
+              {{ snippet_form.Rate }}
+              <input type="hidden" name="next" value="{{ request.get_full_path }}" />
+              </form>
+    </div>
+    <br/>
     <h2> Comments for this snippet: </h2>{% with snippet as object %}{% include "comments/rawcomment.html" %}{% endwith %}.
 
     <h2 id="revise">{% trans "Revise this snippet" %}</h2>