I'm building a custom set of filters, and since I need to do 'OR'
searches it is assembling them as a string that could look like this:
-----
filter_string = "Q(resolution__isnull='on'),
Q(description__icontains='a') | Q(title__icontains='a')"
-----
My problem is getting this from the string I've built into the filter
as a valid type. Obviously the string isn't going to work!

Currently 'eval' is being used to transform the string into something
the filter will recognize like so:
------
final_filters = eval(filter_string)
------

As you may have guessed, this works great for one - but when there are
2 'Q' statements in there separated by a comma, the whole thing is
converted to a tuple and I get a type error.

What would be the *right* way to do this?

Eventually I want to run the following:
-----
queryset = Bug.objects.filter(final_filters)
-----


--~--~---------~--~----~------------~-------~--~----~
 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