mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 03:56:53 -06:00
Introduced 'startswith' template filter
This commit is contained in:
parent
df55ec0114
commit
1a4e8999c5
@ -36,6 +36,14 @@ def gfm(value):
|
||||
return mark_safe(html)
|
||||
|
||||
|
||||
@register.filter()
|
||||
def startswith(value, arg):
|
||||
"""
|
||||
Test whether a string starts with the given argument
|
||||
"""
|
||||
return str(value).startswith(arg)
|
||||
|
||||
|
||||
@register.filter()
|
||||
def user_can_add(model, user):
|
||||
perm_name = '{}:add_{}'.format(model._meta.app_label, model.__class__.__name__.lower())
|
||||
|
Loading…
Reference in New Issue
Block a user