I went through the django-generic-ratings
tutorial, but I am not able to see the form.
I registered my model as following,
from ratings.handlers import ratings
from ratings.forms import SliderVoteForm
ratings.register(Restaurant, score_range=(1, 10), form_class=SliderVoteForm)
I pass restaurant in my view. And my template is:
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery-ui.js" type="text/javascript"></script>
{% load ratings_tags %}
{% get_rating_form for resturant as rating_form %}
<form action="{% url ratings_vote %}" method="post">
{% csrf_token %}
{{ rating_form }}
<p><input type="submit" value="Vote →"></p>
</form>
{% get_rating_score for restaurant as score %}
{% if score %}
Average score: {{ score.average|floatformat }}
Number of votes: {{ score.num_votes }}
{% else %}
How sad: nobody voted {{ restaurant }}
{% endif %}
when I open the vote page, I get a 'Vote Restaurant' button with no visible fields or slider, thus I cannot select any vote. And below 'How sad: nobody voted |<Restaurant: Lemon >|
. When I press 'vote restaurant', it loads another page saying 'Missing required fields."
I use jquery1.9
and jquery-ui-1.10
. And the path is correct, as I check from browser console that its getting loaded.
Another thing is I can rate a restaurant from Admin page, but still it says that the restaurant does not have a vote.