w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Django query: Users can ask many questions and bookmark many questions. How to count total bookmarks for all of a single user's questions asked?
bookmark_count =
User.objects.filter(bookmark__question__user=user).count()
unique_users =
User.objects.filter(bookmark__question__user=user).distinct().count()

You may have to change user in bookmark__question__user to match your question models owner.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.