Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use in django-rest-framework #239

Open
imagine-goku opened this issue Sep 25, 2022 · 0 comments
Open

How to use in django-rest-framework #239

imagine-goku opened this issue Sep 25, 2022 · 0 comments

Comments

@imagine-goku
Copy link

imagine-goku commented Sep 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant