使用django ORM:如何匹配数据库中的结果不为空?
example_objects = Example.objects.filter(field !=null)我不确定如何编写筛选器来获取所有非空记录。
发布于 2010-11-28 05:33:57
我想你要找的是:
Example.objects.filter(field__isnull=False)或者:
Example.objects.exclude(field__isnull=True)发布于 2010-11-28 05:33:40
example_objects = Example.objects.exclude(field=None)发布于 2010-11-28 05:37:16
怎么样
example_objects = Example.objects.exclude(field =null)
https://stackoverflow.com/questions/4293993
复制相似问题