MCPcopy
hub / github.com/django/django / default

Function default

django/template/defaultfilters.py:842–844  ·  view source on GitHub ↗

If value is unavailable, use given default.

(value, arg)

Source from the content-addressed store, hash-verified

840
841@register.filter(is_safe=False)
842def default(value, arg):
843 """If value is unavailable, use given default."""
844 return value or arg
845
846
847@register.filter(is_safe=False)

Callers 5

test_valueMethod · 0.90
test_noneMethod · 0.90
test_empty_stringMethod · 0.90
get_or_setMethod · 0.85
aget_or_setMethod · 0.85

Calls

no outgoing calls

Tested by 3

test_valueMethod · 0.72
test_noneMethod · 0.72
test_empty_stringMethod · 0.72