2011-06-01 143 views
0

如果我做的:過濾查詢集和

People.filter(name = 'Oscar', lastName = 'Mederos) 

將被翻譯成類似:

SELECT ______ WHERE Name = 'Oscar' AND LastName = 'Mederos 

不Django的允許做同樣的,但使用OR代替AND

回答

6

Q objects

People.objects.filter(Q(name='Oscar') | Q(lastName='Mederos')) 
+0

優秀的':)'...... – 2011-06-02 00:41:59