django-model

1.models.Account.objects.filter(id =  1)

 

2. like语句(不敏感)    models.Account.objects.filter(password_startswith='a')    

 

3.select * from Acciunt where password like(%a%) (不敏感)    models.Account.objects.filter(username__contains='a')  (默认是敏感的)   icontains  默认是敏感的等同与like

 

4.select * from app01_account where username id in (1,2)      models.Account.objects.filter(id__in = [1,2,3])    models.Account.objects.filter(username__in = ['alex','jack'])

 

5.gt  : Greater than     gte  :  Greater than or equal to      lt :less than     lte  :  Less than or equal to

 

6.startswith   : Case-sensetive starts-with

 

7. models.Account.objects.filter(headline__startwith = 'Lennon')        select * from Acciunt where password like(a%) 

 

8.istartswith     Case-insensitive starts-with

 

9.endswith       Case-sensitive ends-with

 

10.iendswith    Case-insensitive ends-with

 

posted @ 2019-06-10 09:58  我叫胡啸风  阅读(211)  评论(0编辑  收藏  举报