-
如果至少一個輸入值為真,則返回
True
,如果所有值都為空或沒有值,則返回default
,否則返回False
。使用示例:
class Comment(models.Model): body = models.TextField() published = models.BooleanField() rank = models.IntegerField() >>> from django.db.models import Q >>> from django.contrib.postgres.aggregates import BoolOr >>> Comment.objects.aggregate(boolor=BoolOr('published')) {'boolor': True} >>> Comment.objects.aggregate(boolor=BoolOr(Q(rank__gt=2))) {'boolor': False}
本文介紹 django.contrib.postgres.aggregates.BoolOr
的用法。
聲明
class BoolOr(expression, filter=None, default=None, **extra)
相關用法
- Python Django BoolAnd用法及代碼示例
- Python Django BoundField.label_tag用法及代碼示例
- Python Django BoundField.id_for_label用法及代碼示例
- Python PIL BoxBlur()用法及代碼示例
- Python Django BoundField.initial用法及代碼示例
- Python Django BoundField.value用法及代碼示例
- Python Django BoundField.css_classes用法及代碼示例
- Python Django BoundField.errors用法及代碼示例
- Python Django BoundField.data用法及代碼示例
- Python Django BoundField.name用法及代碼示例
- Python Django BoundField.widget_type用法及代碼示例
- Python Bytes轉Int用法及代碼示例
- Python Bytes轉String用法及代碼示例
- Python Django BaseCommand.style用法及代碼示例
- Python Django BaseFormSet.get_ordering_widget用法及代碼示例
- Python Binary轉Hexadecimal用法及代碼示例
- Python BaseException.with_traceback用法及代碼示例
- Python Django BaseFormSet.ordering_widget用法及代碼示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代碼示例
- Python torch.distributed.rpc.rpc_async用法及代碼示例
- Python torch.nn.InstanceNorm3d用法及代碼示例
- Python sklearn.cluster.MiniBatchKMeans用法及代碼示例
- Python pandas.arrays.IntervalArray.is_empty用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
- Python numpy.less()用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.contrib.postgres.aggregates.BoolOr。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。