-
Notifications
You must be signed in to change notification settings - Fork 160
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
Listing top comments #210
Comments
It's not implemented in the app, but it would be a nice to have feature. |
Thank you. I'll be looking out for your reply :-) |
I can't come up with any medium cost solution. |
Quick question Danirus: Why did you decide to use the CommentFlag system for the likes and dislikes? It might be a stupid idea, but what is the issue with simply having a field in the Comment model containing all the users who liked/disliked the comment. Is it too slow maybe? Let me know what you think ^^ |
The limitation from using The operation that happens the most is to retrieve the comments and its reactions. Ideally that would have to happen without making SQL JOINs to consume as less DB resources as possible. Posting reactions happens less often but it is significant and should happen without complicated queries too. This issue is a top priority. Please, don't hesitate to post your ideas and concerns about it. I'll be glad to read and consider them. |
I see. I will try to implement a clean OneToOne relationship since I might need other reactions in the future. Thanks a lot for the library btw, it's great! Edit: Actually wouldn't it be even better to user ManyToMany relationships with the user base?
|
I prefer a different model to cover slightly different requirements:
The Model I have in mind is this one:
I have pushed this changes to the branch issue-210, check the details in this diff. The like and dislike controllers in the views.py module do work already. Can be tested with the comp example project, with the quotes app. @RealBrionac, are you working on a fix to this issue, planning to send a PR? :-) |
@danirus I'm in the process of adapting the library to fit the need of my current application (mainly adding ajax functions to make everything dynamic with no page refresh, and changing the models). |
The React plugin requires changes to use the new reaction API end point.
please tell, is it possible to make all comments to the object (Post, for example) show already in ascending order from the most popular (from most pluses to the smallest)? @danirus |
With version 2.8 is not possible. With v3.0 it is, but it's not ready yet, you could play with it in the branch rel-3.0.0.
That queryset will give you a descending list of comments by the number of likes a comment has received. I'm sorry it's not done yet. |
Thanks, we'll wait :) |
Just for the record, to get the 5 comments with more "Like" reactions posted to a given
There might be many comments with at least 3 If you run the |
I've tried implementing this from the view without success and I was wondering if such a feature existed.
I want to list top 5 comments for example on an object.
This clearly didn't work :-(
top_Comments = django_comment_flags.objects.filter(flag=="I like it").filter(flag.count>=1)
The text was updated successfully, but these errors were encountered: