1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Implemented BaseTable for consistent rendering

This commit is contained in:
Jeremy Stretch
2016-06-20 16:34:19 -04:00
parent ccc52348be
commit a29e57319e
5 changed files with 72 additions and 156 deletions

View File

@ -3,6 +3,21 @@ import django_tables2 as tables
from django.utils.safestring import mark_safe
class BaseTable(tables.Table):
def __init__(self, *args, **kwargs):
super(BaseTable, self).__init__(*args, **kwargs)
# Set default empty_text if none was provided
if self.empty_text is None:
self.empty_text = 'No {} found.'.format(self._meta.model._meta.verbose_name_plural)
class Meta:
attrs = {
'class': 'table table-hover',
}
class ToggleColumn(tables.CheckBoxColumn):
default = ''
visible = False