Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
5b021a3d
authored
Jun 27, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add host views
parent
8da90009
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
network/urls.py
+2
-0
network/views.py
+27
-0
No files found.
network/urls.py
View file @
5b021a3d
...
@@ -6,4 +6,6 @@ from .views import IndexView, HostList, HostDetail
...
@@ -6,4 +6,6 @@ from .views import IndexView, HostList, HostDetail
urlpatterns
=
patterns
(
urlpatterns
=
patterns
(
''
,
''
,
url
(
'^$'
,
IndexView
.
as_view
(),
name
=
'network.index'
),
url
(
'^$'
,
IndexView
.
as_view
(),
name
=
'network.index'
),
url
(
'^hosts/$'
,
HostList
.
as_view
(),
name
=
'network.host_list'
),
url
(
'^hosts/(?P<pk>
\
d+)/$'
,
HostDetail
.
as_view
(),
name
=
'network.host'
),
)
)
network/views.py
View file @
5b021a3d
from
django.views.generic
import
TemplateView
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
firewall.models
import
Host
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
):
model
=
Host
table_class
=
HostTable
template_name
=
"network/host-list.html"
class
HostDetail
(
UpdateView
):
model
=
Host
template_name
=
"network/host-edit.html"
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