From a0ec831310af9d5206e7bc27cac87fe32ca11063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 28 Jul 2020 22:12:46 +0800 Subject: [PATCH] Removed the unused index template filter from the Mia core application. --- mia_core/templatetags/mia_core.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/mia_core/templatetags/mia_core.py b/mia_core/templatetags/mia_core.py index 4c51cd7..57de68c 100644 --- a/mia_core/templatetags/mia_core.py +++ b/mia_core/templatetags/mia_core.py @@ -185,26 +185,6 @@ def smart_month(value): return defaultfilters.date(value, "Y/n") -@register.filter() -def index(value, arg): - """Returns the arg-th element of the value list or tuple. - - Args: - value (list|tuple): The list or tuple. - arg (int): The index. - - Returns: - any: The arg-th element of the value - """ - if not (isinstance(value, list) or isinstance(value, tuple)): - return None - if not isinstance(arg, int): - return None - if arg >= len(value): - return None - return value[arg] - - @register.filter(name="dict") def dict_value(value, arg): """Returns an element in a dictionary.