mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
tag to call a method with (multiple)args
This commit is contained in:
parent
58b6bbb236
commit
4c7508cd6b
@ -219,6 +219,18 @@ def keyvalue(dict, key):
|
|||||||
return dict[key]
|
return dict[key]
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag()
|
||||||
|
def call_method(obj, method_name, *args):
|
||||||
|
"""
|
||||||
|
enables calling model methods / functions from templates with arguments
|
||||||
|
|
||||||
|
usage:
|
||||||
|
{% call_method model_object 'fnc_name' argument1 %}
|
||||||
|
"""
|
||||||
|
method = getattr(obj, method_name)
|
||||||
|
return method(*args)
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag()
|
@register.simple_tag()
|
||||||
def authorized_owners(group):
|
def authorized_owners(group):
|
||||||
""" Return authorized owners """
|
""" Return authorized owners """
|
||||||
|
Loading…
Reference in New Issue
Block a user