1

I am new to the django, and I am working on a data science project that aims to create a web application that interact with user in order to gather same data in first step, and after that, make a recommendation to the user. My issue is that I have a model Countries that has country_name, user_rating, and user_id as ManyToMany fields, how I can give the user the choice to rate country name using the stars rating and then save the rating in user_rating field ?

Ayoub EL MAJJODI
  • 161
  • 1
  • 10

1 Answers1

2

You can use the django-starfield package [PyPi] to use the Stars widget. You can install this - for example in your local environment, with:

pip3 install django-starfield

then you can use this in your form, like:

from django import forms
from django_starfield import Stars

class SomeForm(forms.Form):
    user_rating = forms.IntegerField(widget=Stars)
Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555