Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /www/wwwroot/sengshao.com/zb_system/function/c_system_event.php on line 2059

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /www/wwwroot/sengshao.com/zb_system/function/c_system_event.php on line 2060

Deprecated: Return type of Config::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/sengshao.com/zb_system/function/lib/config.php on line 26

Deprecated: Return type of Config::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/sengshao.com/zb_system/function/lib/config.php on line 36

Deprecated: Return type of Config::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/sengshao.com/zb_system/function/lib/config.php on line 31

Deprecated: Return type of Config::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/sengshao.com/zb_system/function/lib/config.php on line 41

Deprecated: Return type of Config::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /www/wwwroot/sengshao.com/zb_system/function/lib/config.php on line 17

Deprecated: Constant E_STRICT is deprecated in /www/wwwroot/sengshao.com/zb_system/function/c_system_debug.php on line 80

Deprecated: Constant E_STRICT is deprecated in /www/wwwroot/sengshao.com/zb_system/function/c_system_debug.php on line 80
django filter 查询 - 僧少博客
当前位置:首页 > 编程 > 正文

django filter 查询

    v3 = models.Role.objects.exclude(id=77).filter(id=88) # 排除id=77
    print(v3.query)
   
    v3 = models.Role.objects.filter(id__gt=2) # id > 2
    print(v3.query)

    v3 = models.Role.objects.filter(id__gte=2) # id >= 2
    print(v3.query)
   
    v3 = models.Role.objects.filter(id__lt=2) # id < 2
    print(v3.query)
   
    v3 = models.Role.objects.filter(id__lte=2) # id <=2
    print(v3.query)
   
    v3 = models.Role.objects.filter(id__in=[22, 33, 44])
    print(v3.query)
   
    v3 = models.Role.objects.filter(title__startswith='熊')
    print(v3.query)
   
    v3 = models.Role.objects.filter(title__isnull=True)
    print(v3.query)


发表评论


Deprecated: Constant E_STRICT is deprecated in /www/wwwroot/sengshao.com/zb_system/function/c_system_debug.php on line 80