zoukankan      html  css  js  c++  java
  • Django 单表的双下划线

    ############
    # 单表的双下划线
    models.Person.objects.filter(id__gt=4)  # 大于  greater than
    models.Person.objects.filter(id__lt=4)  # 小于  less than
    models.Person.objects.filter(id__get=4) # 大于等于  greater than equal
    models.Person.objects.filter(id__lte=4) # 小于等于  less than equal
    
    models.Person.objects.filter(id__range=[1,5])   #   范围  左右都包含
    models.Person.objects.filter(id__in=[1,5])  #   成员判断
    
    models.Person.objects.filter(name__contains='alex') #   like
    models.Person.objects.filter(name__icontains='alex')    #   like 忽略大小写
    
    models.Person.objects.filter(name__startswith='alex')   # 以什么开头
    models.Person.objects.filter(name__istartswith='alex')  # 以什么开头 忽略大小写
    
    models.Person.objects.filter(name__endseith='alex') # 以什么结尾
    models.Person.objects.filter(name__iendseith='alex')    # 以什么结尾  忽略大小写
    
    models.Person.objects.filter(birth__year='2020')    #
    models.Person.objects.filter(birth__contains='2020-02') #
    
    models.Person.objects.filter(name__isnull=True) # 字段是否为null

    作者:Star-Hitian,转载请注明原文链接:https://www.cnblogs.com/Star-Haitian/p/15129387.html

  • 相关阅读:
    实验6.1
    SOA
    python的镜像包安装
    中文分词:双向匹配最大算法(BI-MM)
    从github中获取代码
    解决文件冲突
    创建分支
    上传本地文件到github
    mysql事务
    查询练习2
  • 原文地址:https://www.cnblogs.com/Star-Haitian/p/15129387.html
Copyright © 2011-2022 走看看