mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-20 02:06:42 -06:00
add startswith helper
This commit is contained in:
parent
f62e49c02b
commit
b0d634a89e
@ -228,6 +228,16 @@ def meters_to_feet(n):
|
||||
return float(n) * 3.28084
|
||||
|
||||
|
||||
@register.filter("startswith")
|
||||
def startswith(text: str, starts: str) -> bool:
|
||||
"""
|
||||
Template implementation of `str.startswith()`.
|
||||
"""
|
||||
if isinstance(text, str):
|
||||
return text.startswith(starts)
|
||||
return False
|
||||
|
||||
|
||||
#
|
||||
# Tags
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user