<field type="CharField" name="name">Acked-by</field>
<field type="CharField" name="pattern">^Acked-by:</field>
<field type="CharField" name="abbrev">A</field>
+ <field type="BooleanField" name="show_column">True</field>
</object>
<object pk="2" model="patchwork.tag">
<field type="CharField" name="name">Reviewed-by</field>
<field type="CharField" name="pattern">^Reviewed-by:</field>
<field type="CharField" name="abbrev">R</field>
+ <field type="BooleanField" name="show_column">True</field>
</object>
<object pk="3" model="patchwork.tag">
<field type="CharField" name="name">Tested-by</field>
<field type="CharField" name="pattern">^Tested-by:</field>
<field type="CharField" name="abbrev">T</field>
+ <field type="BooleanField" name="show_column">True</field>
</object>
-</django-objects>
\ No newline at end of file
+</django-objects>
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.8 on 2017-12-19 04:03
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('patchwork', '0019_userprofile_show_ids'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='tag',
+ name='show_column',
+ field=models.BooleanField(default=True, help_text=b"Show a column displaying this tag's count in the patch list view"),
+ ),
+ ]
abbrev = models.CharField(
max_length=2, unique=True, help_text='Short (one-or-two letter)'
' abbreviation for the tag, used in table column headers')
+ show_column = models.BooleanField(help_text='Show a column displaying this'
+ ' tag\'s count in the patch list view',
+ default=True)
@property
def attr_name(self):
def patch_tags(patch):
counts = []
titles = []
- for tag in patch.project.tags:
+ for tag in [t for t in patch.project.tags if t.show_column]:
count = getattr(patch, tag.attr_name)
titles.append('%d %s' % (count, tag.name))
if count == 0:
@register.simple_tag(takes_context=True)
def project_tags(context):
+ tags = [t for t in context['project'].tags if t.show_column]
return mark_safe('<span title="%s">%s</span>' % (
- ' / '.join([tag.name for tag in context['project'].tags]),
- '/'.join([tag.abbrev for tag in context['project'].tags])))
+ ' / '.join([tag.name for tag in tags]),
+ '/'.join([tag.abbrev for tag in tags])))