Commit 3a991101 by Őry Máté

network: refactor tables to separate module

parent 5b021a3d
from django_tables2 import Table, A
from django_tables2.columns import LinkColumn
from firewall.models import Host
class HostTable(Table):
hostname = LinkColumn('network.host', args=[A('pk')])
class Meta:
model = Host
attrs = {'class': 'table table-striped table-condensed'}
fields = ('hostname', 'vlan', 'mac', 'ipv4', 'ipv6',
'pub_ipv4', 'created_at', 'owner', )
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.views.generic import UpdateView from django.views.generic import UpdateView
from django_tables2 import SingleTableView, Table, A from django_tables2 import SingleTableView
from django_tables2.columns import LinkColumn
from firewall.models import Host from firewall.models import Host
from .tables import HostTable
class IndexView(TemplateView): class IndexView(TemplateView):
template_name = "network/index.html" template_name = "network/index.html"
class HostTable(Table):
hostname = LinkColumn('network.host', args=[A('pk')])
class Meta:
model = Host
attrs = {'class': 'table table-striped table-condensed'}
fields = ('hostname', 'vlan', 'mac', 'ipv4', 'ipv6',
'pub_ipv4', 'created_at', 'owner', )
class HostList(SingleTableView): class HostList(SingleTableView):
model = Host model = Host
table_class = HostTable table_class = HostTable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment