After reading
1. Annotation
2. In field lookup
3. Aggregate function
4. Subquery
this is the best i come across.
#views.py
sub = Subquery(user[0].intrests.annotate(key=Lower('keyword')).values('key'
))
sponsored_books = models.SponsoredBook.objects.annotate(tit=Lower(
'keywords__title')).filter(ti
I am a little bit confused here but let me try. I think all this
computation should be done one single time and the result should be store
in the database. Whenever these results are required then we straight away
fetch from db.
I would implement it like this
- Keywords would not be full string
Yes your assumptions are right.
I am sorry for irrelevant models code i ma posting, please check in re-post
codes.
#This code is use to match current user interests to SponsoredBook.keywords
and if it matches more than one keyword we increase it's points and finally
we sort this on the basis of
Hey, I was having a bit trouble trying to understand the idea.
- The SponsporedBooks model has user field which isn't being used here.
Where do you plan to user this ?
- The CustomSponsoredBooks model does not have a user field. Are you not
trying to store the points for the books (possible for
Hey, I was having a bit trouble trying to understand the idea.
- The SponsporedBooks model has user field which isn't being used here.
Where do you plan to user this ?
- The CustomSponsoredBooks model does not have a user field. Are you not
trying to store the points for the books (possible for
# This code is use for match the interests of current user to saved
SponsoredBook-keywords
# If same book match with two keywords we increase it's priority by
increasing it's points and finally sort them on the basis of their points
#Please reach out to me if you need more information on the sam
#This code is use to match current user interests to SponsoredBook.keywords
and if it matches more than one keyword we increase it's points and finally
we sort this on the basis of points and pass it to the templates.
#For a small amount of data this works fine as will data will grow this is
goi
7 matches
Mail list logo