From 16e5fb8f5c9a03cc814c7ddde3537dd32059ed3d Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 22 Nov 2017 00:16:39 +0100 Subject: [PATCH] Add multiply filter --- datacenterlight/templatetags/custom_tags.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/datacenterlight/templatetags/custom_tags.py b/datacenterlight/templatetags/custom_tags.py index ce6e6724..908b1f89 100644 --- a/datacenterlight/templatetags/custom_tags.py +++ b/datacenterlight/templatetags/custom_tags.py @@ -31,3 +31,14 @@ def get_value_from_dict(dict_data, key): return dict_data.get(key) else: return "" + + +@register.filter('multiply') +def multiply(value, arg): + """ + usage: {{ quantity|multiply:price }} + :param value: + :param arg: + :return: + """ + return value*arg