You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello devs.
I am proudly using your package, but I have an issue.
I'd like to get my model's total likes programmatically, will be using this to list the entries with most likes.
Thank you.
The text was updated successfully, but these errors were encountered:
Hey. Here are some of my progress.
I runned graphviz to visualize relations within models.
There's no obvious link between Like and Entry.
When I double tabbed to see all attributes of a Like, I saw "receiver" which is a Entry. So I can see a Like's receiver, but I still cannot see an Entries likes. I am a bit confused.
Okay. I have been inspecting your source code and came up with a solution.
@register.simple_tagdefwho_likes(obj):
""" Usage: {% who_likes obj as var %} """returnLike.objects.filter(
receiver_content_type=ContentType.objects.get_for_model(obj),
receiver_object_id=obj.pk
)
with this code, I was able to get a model's like count within templates, now going to implement it for programmatical use.
but I still cannot think of a way to effectively get the model with most likes.
Hello devs.
I am proudly using your package, but I have an issue.
I'd like to get my model's total likes programmatically, will be using this to list the entries with most likes.
Thank you.
The text was updated successfully, but these errors were encountered: