On Mar 4, 2010, at 2:56 PM, aditya wrote:

> I would like to add a new filter for models to my django build that
> can be used as follows:
> 
> tags = ['tag1','tag2','tag3'....'tagn']
> i = Image.objects.filter(tags__contains_any=tags)
> 
> 
> Essentially, instead of passing a string, I pass a list and get a set
> of valid objects that match *any* of the items in the list. I'm a loss
> for where to look for the relevant code, though....I'm trying to find
> where the 'contains' filter has been implemented, so that I can take a
> look at how its written. Currently I'm looking at db.models.query and
> db.models.query_utils.  Where should I be looking?
> 
Hi Aditya,

Won't the "in" filter do exactly what you need?

http://docs.djangoproject.com/en/1.1/ref/models/querysets/#in

---Peter

-- 
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 at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to