django-star-ratings icon indicating copy to clipboard operation
django-star-ratings copied to clipboard

How to use in django-rest-framework

Open imagine-goku opened this issue 2 years ago • 0 comments

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.

imagine-goku avatar Sep 25 '22 06:09 imagine-goku