Introduced 'startswith' template filter
This commit is contained in:
@@ -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())
|
||||
|
Reference in New Issue
Block a user