django-hitcount
django-hitcount copied to clipboard
Feature request: Filter support for filtering hits by user.
I want to display some objects to user, which has zero hits by user. I don't want to loop through all objects for finding objects which has zero hits. Is there any other solution for that?
I think if you add a generic relationship to your model you should be able to query and sort based on the number of hits. See this part of the docs.
Yes, thanks. And is there any easy way to store object's impression and view separately ? E.g. When object is displayed in list, mark it as impression, and when object's page is hit, mark it as view. Till now, I tried customizing app such that, hitcount have new field _type, which denotes impression/view. For, hitcount I set content_type, object_pk & _type as unique_together, but here reverse generic relation won't work, I guess because of object_id set in generic_relation, as there will be multiple entries of object_pk. So I wasn't able to filter/sort by hits. At last, I just created replica of hitcount app, as impression app, customized some templatetags and all. Isn't there any other way possible?
Hi, is there any way to show the name of the user who hits a model.
Hi, is there any way to show the name of the user who hits a model.
yes, see https://github.com/thornomad/django-hitcount/blob/develop/hitcount/models.py#L115