How can I apply dynamic filtering to a Django QuerySet?

widgets = Widget.objects.all()[:10]
filters = {'foo':1,'bar':1,'baz':1}
for f in filters:
    widgets = widgets.filter(f=filters[f])

This breaks down because I can't figure out how to use an expression
as a named parameter.

I've tried eval() and all sort of back tick and quoting combinations,
nothing seems to work.

Thanks,


-- 
Greg Donald
http://destiney.com/

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to