summaryrefslogtreecommitdiff
path: root/patchwork/templatetags
diff options
context:
space:
mode:
authorStephen Finucane <stephen.finucane@intel.com>2015-07-23 11:54:04 +0100
committerStephen Finucane <stephen.finucane@intel.com>2015-11-05 17:08:03 +0000
commit4b9e2c5692261dacf70acfe6a8997c0c60d19c6b (patch)
tree0e8ba5c81c082ecafdcfeee8293b3b213b9aa0cc /patchwork/templatetags
parent15f26de93ce13ae46bb0052403bc4c192ae5724b (diff)
downloadpatchwork-4b9e2c5692261dacf70acfe6a8997c0c60d19c6b.tar
patchwork-4b9e2c5692261dacf70acfe6a8997c0c60d19c6b.tar.gz
templates/patch-list: Add patch "checks" column
Add a column to display the important "checks" fields for each patch. Note that only the "completed" checks are shown (i.e. "in progress" and "not started" checks are ignored). Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Diffstat (limited to 'patchwork/templatetags')
-rw-r--r--patchwork/templatetags/patch.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py
index 3b28158..26cfc13 100644
--- a/patchwork/templatetags/patch.py
+++ b/patchwork/templatetags/patch.py
@@ -1,5 +1,6 @@
# Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
+# Copyright (C) 2015 Intel Corporation
#
# This file is part of the Patchwork package.
#
@@ -20,6 +21,8 @@
from django import template
from django.utils.safestring import mark_safe
+from patchwork.models import Check
+
register = template.Library()
@@ -37,3 +40,14 @@ def patch_tags(patch):
return mark_safe('<span title="%s">%s</span>' % (
' / '.join(titles),
' '.join(counts)))
+
+
+@register.filter(name='patch_checks')
+def patch_checks(patch):
+ required = [Check.STATE_SUCCESS, Check.STATE_WARNING, Check.STATE_FAIL]
+ titles = ['Success', 'Warning', 'Fail']
+ counts = patch.check_count
+
+ return mark_safe('<span title="%s">%s</span>' % (
+ ' / '.join(titles),
+ ' '.join([str(counts[state]) for state in required])))