models.数据库名称.objects.filter(mobile='xx',id=xx)
效果等同于 data_dict = {"mobile ": "xx ", "id": xx}
mobile.数据库名称.objects.filter(**data_dict)
mobile.数据库名称.objects.filter(id = 12) #等于12
mobile.数据库名称.objects.filter(id__gt = 12) #大于12
mobile.数据库名称.objects.filter(id__gte = 12) #大于等于12
mobile.数据库名称.objects.filter(id__lt = 12) #小于12
mobile.数据库名称.objects.filter(id__lte = 12) #小于等于12
data_dict = {"id__lte" : 12}
mobile.数据库名称.objects.filter(**data_dict)
mobile.数据库名称.objects.filter(mobile = '999') #等于
mobile.数据库名称.objects.filter(mobile__startwith = "199") #以199开头的字符串
mobile.数据库名称.objects.filter(mobile__endwith = "999") #以999结尾的字符串
mobile.数据库名称.objects.filter(mobile__contains = "999") #筛选出包含999
data_dict = {"mobile__contains":"999"}
mobile.数据库名称.objects.filter(**data_dict)
标签:__,12,mobile,数据库,django,filter,objects,搜索 From: https://www.cnblogs.com/haozhang01/p/17170757.html