Hi, I am trying to learn django comments customization by adding an integer 
field to the comments framework. My Model looks like below

class CommentWithRating(Comment): rating = 
models.IntegerField(name='rating')

And i am trying to display the value in the rating field by using the 
jquery star, but it is displaying all the stars in one comment. Please 
check the link to see how the comments are displayed. 
http://imgur.com/43CUU<http://i.imgur.com/43CUU.jpg>
 [1]

The code i am using in my template is as below.

        <div class="comments">
            {% load comments %}
            </br>
            <h4> Add Your Comments Here / Rate : </h4></br>
            {% render_comment_form for party_details %}
            {% get_comment_count for party_details as comment_count %}
            <p> <b> Customer Reviews</b>( {{ comment_count }} comments have 
been posted.)</p>
            </br>
            {% get_comment_list for party_details as comment_list %}
            {% for comment in comment_list %}
                <div class="ind_comment">
                    <p><u>Posted by: <i>{{ comment.user_name }}</i> on {{ 
comment.submit_date }}</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rating:                
                        <div class="comment_star">
                            {% for i in loop_times %}
                                {% if i == comment.rating %}
                                    <input name="star" type="radio" 
class="star" checked="checked" disabled="disabled"/>
                                {% else %}
                                    <input name="star" type="radio" 
class="star" disabled="disabled"/>
                                {% endif %}
                            {% endfor %}
                            {{ comment.rating }}
                        </div>
                    </p>
                    <p>Comment: {{ comment.comment }}</p>
                </div>
            {% endfor %}
        </div>

I am working on Django 1.4.1 version and 
http://www.fyneworks.com/jquery/star-rating/#tab-Overview[2] (for jquery 
stars). loop_times in the template is a range from 1 to 5, which is passed 
from the view.

Can anyone help with why the ratings are all displayed in one place when i 
use jquery star.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SzYM0O2tyl4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to