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

Add Description for Annotate function in manager #22

Closed
ialex opened this issue Mar 3, 2016 · 2 comments
Closed

Add Description for Annotate function in manager #22

ialex opened this issue Mar 3, 2016 · 2 comments

Comments

@ialex
Copy link
Contributor

ialex commented Mar 3, 2016

Would you be so kind to explain how the annotate function works for the votes Manager, i would like to be able to get the num of votes in a query to related model and if it would be posible to also include if user have voted.

@ialex
Copy link
Contributor Author

ialex commented Mar 3, 2016

This seems to work properly Comment.objects.filter(post=4).annotate(num_votes=Count('votes'))

@shellfly
Copy link
Owner

shellfly commented Mar 3, 2016

It's just a shortcut for convenience, you can view the code for detail usage.

@ialex ialex closed this as completed Mar 3, 2016
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

2 participants