0

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 &rarr;"></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.

lmcanavals
  • 2,339
  • 1
  • 24
  • 35
Emmet B
  • 5,341
  • 6
  • 34
  • 47
  • Yes. I am sure that problem is not with jquery. Because even this does not work: `{% load ratings_tags %} {% get_rating_form for film as rating_form %}
    {% csrf_token %} {{ rating_form }}

    `
    – Emmet B Jan 21 '13 at 04:17
  • No still could not, yesterday I tried again too. – Emmet B Mar 22 '13 at 07:29

0 Answers0