You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, there is a common usage of Value(False) | Value(True) in Django projects. Ruff does not provide any configuration to extend the FBT003 default whitelist. So my request would be 1) Ignore Value by default like #6711 2) settings to extend FBT003 whitelist.
fromdjango.db.modelsimportCase, Q, Value, When
...
qs.annotate(
is_foo_or_bar=Case(
When(Q(is_foo=True) |Q(is_bar=True)),
then=Value(True), # noqa: FBT003
),
default=Value(False), # noqa: FBT003
)
The text was updated successfully, but these errors were encountered:
@9128305 It should be possible to use then=True and default=False directly without wrapping with Value(), and that goes for most basic types, not just booleans. The exception is where strings are used, as then="string" would be interpreted as then=F("string"), i.e. a column name, and so then=Value("string") is required explicitly.
Hi, there is a common usage of
Value(False)
|Value(True)
in Django projects. Ruff does not provide any configuration to extend the FBT003 default whitelist. So my request would be 1) IgnoreValue
by default like #6711 2) settings to extend FBT003 whitelist.The text was updated successfully, but these errors were encountered: