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
Commit
8f0735c7
authored
Nov 12, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add unregistered dhcp clients table
parent
ec0e901c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
circle/network/tables.py
+14
-0
circle/network/templates/network/columns/host-register.html
+3
-0
circle/network/templates/network/vlan-edit.html
+6
-0
circle/network/views.py
+5
-2
No files found.
circle/network/tables.py
View file @
8f0735c7
...
...
@@ -122,6 +122,20 @@ class SmallHostTable(Table):
attrs
=
{
'class'
:
'table table-striped table-condensed'
}
fields
=
(
'hostname'
,
'ipv4'
)
order_by
=
(
'vlan'
,
'hostname'
,
)
empty_text
=
_
(
"No hosts."
)
class
SmallDhcpTable
(
Table
):
mac
=
MACColumn
(
verbose_name
=
_
(
"MAC address"
))
hostname
=
Column
(
verbose_name
=
_
(
"hostname"
))
ip
=
Column
(
verbose_name
=
_
(
"requested IP"
))
register
=
TemplateColumn
(
template_name
=
"network/columns/host-register.html"
,
attrs
=
{
"th"
:
{
"style"
:
"display: none;"
}})
class
Meta
:
attrs
=
{
'class'
:
'table table-striped table-condensed'
}
empty_text
=
_
(
"No hosts."
)
class
RecordTable
(
Table
):
...
...
circle/network/templates/network/columns/host-register.html
0 → 100644
View file @
8f0735c7
{% load i18n %}
<a
href=
"{% url "
network
.
host_create
"
%}?
vlan=
{{
object
.
pk
}}&
amp
;
mac=
{{
record
.
mac
}}&
amp
;
hostname=
{{
record
.
hostname
}}&
amp
;
ipv4=
{{
record
.
ip
}}"
title=
"{% trans "
register
host
"
%}"
><i
class=
"fa fa-plus-circle"
></i></a>
circle/network/templates/network/vlan-edit.html
View file @
8f0735c7
...
...
@@ -22,6 +22,12 @@
<h3>
{% trans "Host list" %}
</h3>
</div>
{% render_table host_list %}
<div
class=
"page-header"
>
<h3>
{% trans "Unregistered hosts" %}
</h3>
</div>
{% render_table dhcp_list %}
<div
class=
"page-header"
>
<h3>
{% trans "Manage access" %}
</h3>
</div>
...
...
circle/network/views.py
View file @
8f0735c7
...
...
@@ -20,7 +20,7 @@ from django.views.generic import (TemplateView, UpdateView, DeleteView,
from
django.core.exceptions
import
ValidationError
from
django.core.urlresolvers
import
reverse_lazy
from
django.shortcuts
import
render
,
redirect
,
get_object_or_404
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
,
Http404
from
django_tables2
import
SingleTableView
...
...
@@ -30,7 +30,7 @@ from vm.models import Interface
from
.tables
import
(
HostTable
,
VlanTable
,
SmallHostTable
,
DomainTable
,
GroupTable
,
RecordTable
,
BlacklistItemTable
,
RuleTable
,
VlanGroupTable
,
SmallRuleTable
,
SmallGroupRuleTable
,
SmallRecordTable
,
SwitchPortTable
)
SmallRecordTable
,
SwitchPortTable
,
SmallDhcpTable
,
)
from
.forms
import
(
HostForm
,
VlanForm
,
DomainForm
,
GroupForm
,
RecordForm
,
BlacklistItemForm
,
RuleForm
,
VlanGroupForm
,
SwitchPortForm
)
...
...
@@ -434,6 +434,8 @@ class HostCreate(LoginRequiredMixin, SuperuserRequiredMixin,
if
i
in
self
.
request
.
GET
and
i
not
in
self
.
request
.
POST
:
initial
[
i
]
=
self
.
request
.
GET
[
i
]
if
"vlan"
in
initial
:
if
not
initial
[
'vlan'
]
.
isnumeric
():
raise
Http404
()
vlan
=
get_object_or_404
(
Vlan
.
objects
,
pk
=
initial
[
'vlan'
])
try
:
initial
.
update
(
vlan
.
get_new_address
())
...
...
@@ -711,6 +713,7 @@ class VlanDetail(LoginRequiredMixin, SuperuserRequiredMixin,
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
VlanDetail
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'host_list'
]
=
SmallHostTable
(
self
.
object
.
host_set
.
all
())
context
[
'dhcp_list'
]
=
SmallDhcpTable
(
self
.
object
.
get_dhcp_clients
())
context
[
'vlan_vid'
]
=
self
.
kwargs
.
get
(
'vid'
)
context
[
'acl'
]
=
AclUpdateView
.
get_acl_data
(
self
.
object
,
self
.
request
.
user
,
'network.vlan-acl'
)
...
...
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