mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 06:26:37 +00:00
Add sub
filter
This is the opposite of the default `add` filter.
This commit is contained in:
parent
29c2d44704
commit
e284f760af
@ -12,3 +12,14 @@ def bytesformat(input):
|
|||||||
return output
|
return output
|
||||||
return output[: -1 ] + 'iB'
|
return output[: -1 ] + 'iB'
|
||||||
|
|
||||||
|
@register.filter(is_safe=False)
|
||||||
|
def sub(value, arg):
|
||||||
|
"""Subtract the arg from the value."""
|
||||||
|
try:
|
||||||
|
return int(value) - int(arg)
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
try:
|
||||||
|
return value - arg
|
||||||
|
except Exception:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user