views:

48

answers:

1

I am new to django and need some quick help.
How will the following sql statement be translated in django ORM?

SELECT * from table_name WHERE field1 = v1 OR field2 = v2

Thanks in advance!

+1  A: 

Use Q-objects:

Model.objects.filter(Q(field1=v1) | Q(field2=v2))
drmegahertz