cb8f3ddf4e
Fixes bug 953483. Change-Id: Ie6b858a9a595d024f71ca372a11b97a454b3b1e8
35 lines
801 B
Python
35 lines
801 B
Python
import logging
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from horizon import tables
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
class QuotaFilterAction(tables.FilterAction):
|
|
def filter(self, table, tenants, filter_string):
|
|
q = filter_string.lower()
|
|
|
|
def comp(tenant):
|
|
if q in tenant.name.lower():
|
|
return True
|
|
return False
|
|
|
|
return filter(comp, tenants)
|
|
|
|
|
|
class QuotasTable(tables.DataTable):
|
|
name = tables.Column('name', verbose_name=_('Quota Name'))
|
|
limit = tables.Column("limit", verbose_name=_('Limit'))
|
|
|
|
def get_object_id(self, obj):
|
|
return obj.name
|
|
|
|
class Meta:
|
|
name = "quotas"
|
|
verbose_name = _("Quotas")
|
|
table_actions = (QuotaFilterAction,)
|
|
multi_select = False
|