Thank you Constantine,
I got this mistake fixed and this was really bad mistake from my side. Now
with your proposed scenario I am trying to get it work with
"trending_products = Product.objects.all().order_by('hits__hits')[:6]" but
still it isn't giving me sort by max hits as I used annotate method with Max
as well. Also did count for hits. Any suggestions on this now.
Thank you for your response.
On Thursday, August 4, 2016 at 2:10:48 PM UTC-7, Constantine Covtushenko
wrote:
>
> Please check my notes below:
>
> On Thu, Aug 4, 2016 at 10:42 PM, M Hashmi <[email protected]
> <javascript:>> wrote:
>
>> My field hits=models.ForeignKey(Hitcount) means that my Product model has
>> a related model with multiple fields and all the products in Product model
>> will have one or more hit records.
>>
> Sorry but I do not see how Product model will have many hit records.
> May be you should change it on:
>
> hits = models.ManyToMany(Hitcount)
>
>
>
>> Instance of Product model will save a hit from end user by
>> session/ip/user etc.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/81557c06-29ac-44d0-b76c-b3fea37c83f2%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/django-users/81557c06-29ac-44d0-b76c-b3fea37c83f2%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/57953851-750f-4592-8fe3-515bae3ab03f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.