Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 5, 2011 00:11:32

c.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 21st of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support