Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d811b880
authored
May 13, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: handle ManyToMany fields
parent
f5f11cd8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
firewall_gui/views.py
+6
-2
No files found.
firewall_gui/views.py
View file @
d811b880
...
...
@@ -43,9 +43,13 @@ def json_attr(entity, attr):
'id'
:
entity
.
id
,
'name'
:
getattr
(
entity
,
common_names
[
attr
]
if
attr
in
common_names
.
keys
()
else
'name'
)
}
if
entity
else
None
,
'DateTimeField'
:
lambda
entity
:
entity
.
isoformat
()
'DateTimeField'
:
lambda
entity
:
entity
.
isoformat
(),
'ManyToManyField'
:
lambda
field
:
[{
'id'
:
entity
.
id
,
'name'
:
getattr
(
entity
,
common_names
[
attr
]
if
attr
in
common_names
.
keys
()
else
'name'
)
}
for
entity
in
field
.
all
()]
}[
entity
.
_meta
.
get_field_by_name
(
attr
)[
0
]
.
__class__
.
__name__
](
getattr
(
entity
,
attr
))
except
:
except
Exception
as
e
:
return
getattr
(
entity
,
attr
)
return
getattr
(
entity
,
attr
)
...
...
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