I've spent a little too much time on this, but before I decided to make a custom sql query, I wanted to see if anyone could provide any assistance. It is really a python question, and the problem I'm having is I'm not an expert yet with python.
First, I have a list of dictionaries. [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ] I want to do a SQL query like this: SELECT * FROM mytable WHERE (id = 1 AND title = 'test1') OR (id = 2 AND title = 'test2') I know I can use the Q object, like: MyModel.objects.filter(Q(id=1) & Q(title='test1') | Q(id=2) & Q(title='test2')) My question is how can I convert my list to those Q objects? The list may have 2 dictionaries in it like this, or it may have 20. My hangup is getting things into separate Q objects with the correct operator in between them. There could also be a better way that I don't know of! Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---