Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a017e6cf
authored
Jul 23, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add list of hosts to vlan-update
parent
1b082f78
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
40 deletions
+59
-40
network/forms.py
+33
-38
network/tables.py
+11
-0
network/templates/network/vlan-edit.html
+8
-1
network/views.py
+7
-1
No files found.
network/forms.py
View file @
a017e6cf
...
@@ -75,44 +75,39 @@ class VlanForm(ModelForm):
...
@@ -75,44 +75,39 @@ class VlanForm(ModelForm):
helper
.
layout
=
Layout
(
helper
.
layout
=
Layout
(
Div
(
Div
(
Row
(
Row
(
Div
(
Fieldset
(
Fieldset
(
'Identity'
,
'Identity'
,
'name'
,
'name'
,
'vid'
,
'vid'
,
'interface'
,
'interface'
,
),
),
Fieldset
(
Fieldset
(
'IPv4'
,
'IPv4'
,
'net4'
,
'net4'
,
'prefix4'
,
'prefix4'
,
'ipv4'
,
'ipv4'
,
'snat_to'
,
'snat_to'
,
'snat_ip'
,
'snat_ip'
,
'dhcp_pool'
,
'dhcp_pool'
,
),
),
Fieldset
(
Fieldset
(
'IPv6'
,
'IPv6'
,
'net6'
,
'net6'
,
'prefix6'
,
'prefix6'
,
'ipv6'
,
'ipv6'
,
),
),
Fieldset
(
Fieldset
(
'Domain name service'
,
'Domain name service'
,
'domain'
,
'domain'
,
'reverse_domain'
,
'reverse_domain'
,
),
),
Fieldset
(
Fieldset
(
'Info'
,
'Info'
,
'description'
,
'description'
,
'comment'
,
'comment'
,
# 'created_at',
# 'created_at',
# 'modified_at',
# 'modified_at',
),
),
css_class
=
'span8'
),
Div
(
HTML
(
'<p>hello</p>'
),
css_class
=
'span4'
),
),
),
ButtonHolder
(
ButtonHolder
(
Submit
(
'submit'
,
'Save'
),
Submit
(
'submit'
,
'Save'
),
...
...
network/tables.py
View file @
a017e6cf
...
@@ -15,6 +15,17 @@ class HostTable(Table):
...
@@ -15,6 +15,17 @@ class HostTable(Table):
order_by
=
(
'vlan'
,
'hostname'
,
)
order_by
=
(
'vlan'
,
'hostname'
,
)
# inheritance by copy-paste
class
SmallHostTable
(
Table
):
hostname
=
LinkColumn
(
'network.host'
,
args
=
[
A
(
'pk'
)])
class
Meta
:
model
=
Host
attrs
=
{
'class'
:
'table table-striped table-condensed'
}
fields
=
(
'hostname'
,
'ipv4'
)
order_by
=
(
'vlan'
,
'hostname'
,
)
class
VlanTable
(
Table
):
class
VlanTable
(
Table
):
name
=
LinkColumn
(
'network.vlan'
,
args
=
[
A
(
'pk'
)])
name
=
LinkColumn
(
'network.vlan'
,
args
=
[
A
(
'pk'
)])
...
...
network/templates/network/vlan-edit.html
View file @
a017e6cf
...
@@ -7,8 +7,15 @@
...
@@ -7,8 +7,15 @@
{% block content %}
{% block content %}
<div
class=
"page-heading"
>
<div
class=
"page-heading"
>
<h1>
{{ form.
hostname.value }}
<small>
details of host
</small></h1>
<h1>
{{ form.
name.value }}
<small>
details of vlan
</small></h1>
</div>
</div>
<div
class=
"row"
>
<div
class=
"span8"
>
{% crispy form %}
{% crispy form %}
</div>
<div
class=
"span4"
>
{% render_table host_list %}
</div>
</div>
{% endblock %}
{% endblock %}
network/views.py
View file @
a017e6cf
...
@@ -4,7 +4,7 @@ from django.views.generic import UpdateView
...
@@ -4,7 +4,7 @@ from django.views.generic import UpdateView
from
django_tables2
import
SingleTableView
from
django_tables2
import
SingleTableView
from
firewall.models
import
Host
,
Vlan
from
firewall.models
import
Host
,
Vlan
from
.tables
import
HostTable
,
VlanTable
from
.tables
import
HostTable
,
VlanTable
,
SmallHostTable
from
.forms
import
HostForm
,
VlanForm
from
.forms
import
HostForm
,
VlanForm
...
@@ -34,3 +34,9 @@ class VlanDetail(UpdateView):
...
@@ -34,3 +34,9 @@ class VlanDetail(UpdateView):
model
=
Vlan
model
=
Vlan
template_name
=
"network/vlan-edit.html"
template_name
=
"network/vlan-edit.html"
form_class
=
VlanForm
form_class
=
VlanForm
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
VlanDetail
,
self
)
.
get_context_data
(
**
kwargs
)
q
=
Host
.
objects
.
filter
(
vlan
=
self
.
object
)
.
all
()
context
[
'host_list'
]
=
SmallHostTable
(
q
)
return
context
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