I’d like to modify the existing Django comments framework to include star ratings. The Django site has good documentation on modifying the comments framework here, but I still have a few questions.
- Unfortunately I don’t have much experience modifying forms. If I wanted to incorporate the jQuery star rating plugin into my form how would I go about doing that?
- When creating my custom comment model I assume a IntegerField or a FloatField would be best to store the rating?
- Should I write a validator to verify that the rating is between 0-5 or whatever the range ends up being, or will I not have to worry about that because the star ratings will only go 0-5?
You can set HTML attributes into your inputs (class=”star”) as described here : https://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Widget.attrs
Probably a IntegerField, keep it simple.
No, a user could hack the javascript and submit any value. Never trust user input ! Write your own validator 🙂