Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
51b375a9
authored
May 16, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: show record details
parent
69d7abf6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletions
+27
-1
firewall_gui/views.py
+27
-1
No files found.
firewall_gui/views.py
View file @
51b375a9
...
@@ -69,7 +69,7 @@ def make_entity_lister(entity_type, mapping):
...
@@ -69,7 +69,7 @@ def make_entity_lister(entity_type, mapping):
''' jsonify one entity '''
''' jsonify one entity '''
result
=
{}
result
=
{}
for
attr
in
mapping
:
for
attr
in
mapping
:
# if `attr` is a tuple, the first element is the key in the JSON, the second is a
lambda
function that calculates the value
# if `attr` is a tuple, the first element is the key in the JSON, the second is a function that calculates the value
if
type
(
attr
)
is
tuple
:
if
type
(
attr
)
is
tuple
:
result
[
attr
[
0
]]
=
attr
[
1
](
entity
)
result
[
attr
[
0
]]
=
attr
[
1
](
entity
)
else
:
else
:
...
@@ -370,6 +370,32 @@ def show_hostgroup(request, id):
...
@@ -370,6 +370,32 @@ def show_hostgroup(request, id):
}
}
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
def
show_record
(
request
,
id
):
record
=
get_object_or_404
(
Record
,
id
=
id
)
record
=
{
'id'
:
record
.
id
,
'name'
:
record
.
name
,
'domain'
:
{
'id'
:
record
.
domain
.
id
,
'name'
:
record
.
domain
.
name
},
'host'
:
{
'id'
:
record
.
host
.
id
,
'name'
:
record
.
host
.
hostname
}
if
record
.
host
else
None
,
'type'
:
record
.
type
,
'address'
:
record
.
address
,
'ttl'
:
record
.
ttl
,
'owner'
:
{
'id'
:
record
.
owner
.
id
,
'name'
:
record
.
owner
.
username
},
'description'
:
record
.
description
,
'created_at'
:
record
.
created_at
.
isoformat
(),
'modified_at'
:
record
.
modified_at
.
isoformat
(),
}
return
HttpResponse
(
json
.
dumps
(
record
),
content_type
=
'application/json'
)
def
make_autocomplete
(
entity
,
name
=
'name'
):
def
make_autocomplete
(
entity
,
name
=
'name'
):
def
autocomplete
(
request
):
def
autocomplete
(
request
):
...
...
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