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
ec0e901c
authored
Nov 12, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add MACColumn
parent
521aa877
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
circle/network/tables.py
+18
-4
circle/network/templates/network/columns/mac.html
+0
-3
No files found.
circle/network/tables.py
View file @
ec0e901c
...
@@ -15,14 +15,30 @@
...
@@ -15,14 +15,30 @@
# You should have received a copy of the GNU General Public License along
# You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from
netaddr
import
EUI
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.html
import
format_html
from
django_tables2
import
Table
,
A
from
django_tables2
import
Table
,
A
from
django_tables2.columns
import
LinkColumn
,
TemplateColumn
from
django_tables2.columns
import
LinkColumn
,
TemplateColumn
,
Column
from
firewall.models
import
Host
,
Vlan
,
Domain
,
Group
,
Record
,
Rule
,
SwitchPort
from
firewall.models
import
Host
,
Vlan
,
Domain
,
Group
,
Record
,
Rule
,
SwitchPort
class
MACColumn
(
Column
):
def
render
(
self
,
value
):
if
isinstance
(
value
,
basestring
):
try
:
value
=
EUI
(
value
)
except
:
return
value
try
:
return
format_html
(
'<abbr title="{0}">{1}</abbr>'
,
value
.
oui
.
registration
()
.
org
,
value
)
except
:
return
value
class
BlacklistItemTable
(
Table
):
class
BlacklistItemTable
(
Table
):
ipv4
=
LinkColumn
(
'network.blacklist'
,
args
=
[
A
(
'pk'
)])
ipv4
=
LinkColumn
(
'network.blacklist'
,
args
=
[
A
(
'pk'
)])
...
@@ -55,9 +71,7 @@ class GroupTable(Table):
...
@@ -55,9 +71,7 @@ class GroupTable(Table):
class
HostTable
(
Table
):
class
HostTable
(
Table
):
hostname
=
LinkColumn
(
'network.host'
,
args
=
[
A
(
'pk'
)])
hostname
=
LinkColumn
(
'network.host'
,
args
=
[
A
(
'pk'
)])
mac
=
TemplateColumn
(
mac
=
MACColumn
()
template_name
=
"network/columns/mac.html"
)
class
Meta
:
class
Meta
:
model
=
Host
model
=
Host
...
...
circle/network/templates/network/columns/mac.html
deleted
100644 → 0
View file @
521aa877
{% load i18n %}
<span
title=
"{% blocktrans with vendor=record.hw_vendor|default:"
n
/
a
"
%}
Vendor:
{{
vendor
}}{%
endblocktrans
%}"
>
{{ record.mac }}
</span>
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