django-star-ratings
django-star-ratings copied to clipboard
How to use in django-rest-framework
I have a model called Books
and an API to add books and update the ratings.
class Book(models.Model):
name = models.CharField(max_length=200, blank=True, null=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
ratings = GenericRelation(Rating, related_query_name="books")
I read the documentation, I have a few questions 1 . how to add ratings i.e how to use them in my views directly. I would like to know your view on this. 2. I went and checked out the model definition. there I found 2 of them. I am thinking this is the model. Can you give me a brief on how to use this i.e if this is the one to use.