from __future__ import unicode_literals import django_tables2 as tables from taggit.models import Tag from utilities.tables import BaseTable, ToggleColumn TAG_ACTIONS = """ {% if perms.taggit.change_tag %} {% endif %} {% if perms.taggit.delete_tag %} {% endif %} """ class TagTable(BaseTable): pk = ToggleColumn() actions = tables.TemplateColumn( template_code=TAG_ACTIONS, attrs={'td': {'class': 'text-right'}}, verbose_name='' ) class Meta(BaseTable.Meta): model = Tag fields = ('pk', 'name', 'items')