Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3a991101
authored
Jun 27, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: refactor tables to separate module
parent
5b021a3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
network/tables.py
+14
-0
network/views.py
+2
-12
No files found.
network/tables.py
0 → 100644
View file @
3a991101
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'
,
)
network/views.py
View file @
3a991101
from
django.views.generic
import
TemplateView
from
django.views.generic
import
UpdateView
from
django_tables2
import
SingleTableView
,
Table
,
A
from
django_tables2.columns
import
LinkColumn
from
django_tables2
import
SingleTableView
from
firewall.models
import
Host
from
.tables
import
HostTable
class
IndexView
(
TemplateView
):
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
):
model
=
Host
table_class
=
HostTable
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment