From cf717055ac5cb379e3ac45e4ed52abacd98e67ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Fri, 6 Nov 2015 09:11:49 +0100 Subject: [PATCH] Fix TypeErrors: sequence item expected str, None found (ex: ','.join([None, 'a', 'b'])) --- taiga/projects/history/templatetags/functions.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/taiga/projects/history/templatetags/functions.py b/taiga/projects/history/templatetags/functions.py index b5118c3a..3c3ce143 100644 --- a/taiga/projects/history/templatetags/functions.py +++ b/taiga/projects/history/templatetags/functions.py @@ -40,4 +40,12 @@ def verbose_name(obj_class, field_name): @library.global_function def lists_diff(list1, list2): - return (list(set(list1) - set(list2))) + """ + Get the difference of two list and remove None values. + + >>> list1 = ["a", None, "b", "c"] + >>> list2 = [None, "b", "d", "e"] + >>> list(filter(None.__ne__, set(list1) - set(list2))) + ['c', 'a'] + """ + return list(filter(None.__ne__, set(list1) - set(list2)))