Make "enabled" colume values display-friendly and consistent

Most boolean columes are displayed through yesno_filter
and capfirst_filter, but the changed field were not.

In addition, by using yesno_filter, the corresponding colums
are displayed with translated strings and it fixes I18N bug
at the same time.

The following columes are updated by this patch.

Identity -> Domains (enabled)
Identity -> Users (enabled)
Identity -> Groups (enabled)
Firewall -> Rules (enabled, audited)

Change-Id: I35eeed6addc8f58faa34bc990c758523e4830960
Closes-Bug: #1422074
This commit is contained in:
Akihiro Motoki 2015-02-15 17:11:50 +09:00
parent fda45dbcc5
commit 3f92e75861
4 changed files with 11 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template import defaultfilters as filters
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
@ -199,7 +200,8 @@ class DomainsTable(tables.DataTable):
description = tables.Column(lambda obj: getattr(obj, 'description', None),
verbose_name=_('Description'))
id = tables.Column('id', verbose_name=_('Domain ID'))
enabled = tables.Column('enabled', verbose_name=_('Enabled'), status=True)
enabled = tables.Column('enabled', verbose_name=_('Enabled'), status=True,
filters=(filters.yesno, filters.capfirst))
class Meta(object):
name = "domains"

View File

@ -195,6 +195,8 @@ class UsersTable(tables.DataTable):
enabled = tables.Column('enabled', verbose_name=_('Enabled'),
status=True,
status_choices=STATUS_CHOICES,
filters=(defaultfilters.yesno,
defaultfilters.capfirst),
empty_value=_('False'))

View File

@ -236,6 +236,8 @@ class UsersTable(tables.DataTable):
enabled = tables.Column('enabled', verbose_name=_('Enabled'),
status=True,
status_choices=STATUS_CHOICES,
filters=(defaultfilters.yesno,
defaultfilters.capfirst),
empty_value="False")
class Meta(object):

View File

@ -213,7 +213,8 @@ class RulesTable(tables.DataTable):
filters=(filters.upper,),
verbose_name=_("Action"))
enabled = tables.Column("enabled",
verbose_name=_("Enabled"))
verbose_name=_("Enabled"),
filters=(filters.yesno, filters.capfirst))
firewall_policy_id = tables.Column(get_policy_name,
link=get_policy_link,
verbose_name=_("In Policy"))
@ -232,7 +233,8 @@ class PoliciesTable(tables.DataTable):
firewall_rules = tables.Column(get_rules_name,
verbose_name=_("Rules"))
audited = tables.Column("audited",
verbose_name=_("Audited"))
verbose_name=_("Audited"),
filters=(filters.yesno, filters.capfirst))
class Meta(object):
name = "policiestable"