Django filter Q对象使用
from django.db.models import Q
contact_item = Contact.objects.filter( Q(contact1_en=username) |Q(contact2_en=username))
上述代码Q:模糊查询
| : or
类似于下面的SQL语句(username为变量,应该为对应的字符串"****%")
select * from contact where contact1_en like username or contact2_en like username