multiple x__search
I'm using __search to boolean search for a list of words within two
separate lists (requiredTags, preferredTags). Line 10 is the one I
have questions about. I want to see if the list of words (requTags)
is found among requiredTags or preferredTags.
requTags=""
prefeTags=""
for i in reqTags:
if(i!=""):
requTags+="+"+i+" "
for i in prefTags:
if(i!=""):
prefeTags+=i+" "
if(requTags!=""):
query=query &( Q(requiredTags__search +
preferredTags__search = requTags))
if(prefeTags!=""):
query=query &( Q(requiredTags__search = prefeTags) |
Q(preferredTags__search = prefeTags))
For instance:
requTags might be: +beans +rice +cheese.
requiredTags might be: beans,rice,tortilla
preferredTags might be: cheese
I didn't see any way to combine requiredTags and preferredTags in the
documentation. Any help would be appreciated. Note: I'm a complete
noob.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home