Specifically, I\'m trying to use a string to arbitrairly filter the ORM. I\'ve tried exec and eval solutions, but I\'m running into walls. The code below doesn\'t work, bu
The eval option should work fine, as long as you wrap it around the entire expression, not just the f:
eval
f
f = 'image__endswith="jpg"' d = eval('Image.objects.filter(' + f + ')')