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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
bc2a90c8
authored
May 28, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: fix missing foreign keys during entity creation
parent
0d815cd3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
firewall_gui/views.py
+14
-14
No files found.
firewall_gui/views.py
View file @
bc2a90c8
...
...
@@ -582,10 +582,10 @@ def save_host(request):
@user_passes_test
(
req_staff
)
def
save_vlan
(
request
):
data
=
json
.
loads
(
request
.
body
)
if
data
[
'id'
]:
if
'id'
in
data
and
data
[
'id'
]:
vlan
=
get_object_or_404
(
Vlan
,
id
=
data
[
'id'
])
else
:
vlan
=
Vlan
.
objects
.
create
()
vlan
=
Vlan
()
errors
=
{}
vlan
.
vid
=
data
[
'vid'
]
vlan
.
name
=
data
[
'name'
]
...
...
@@ -620,15 +620,15 @@ def save_vlan(request):
if
len
(
errors
)
>
0
:
return
HttpResponse
(
json
.
dumps
(
errors
),
content_type
=
'application/json'
,
status
=
400
)
vlan
.
save
()
return
HttpResponse
(
'KTHXBYE'
)
return
HttpResponse
(
vlan
.
id
)
@user_passes_test
(
req_staff
)
def
save_vlangroup
(
request
):
data
=
json
.
loads
(
request
.
body
)
if
data
[
'id'
]:
if
'id'
in
data
and
data
[
'id'
]:
vlangroup
=
get_object_or_404
(
VlanGroup
,
id
=
data
[
'id'
])
else
:
vlangroup
=
VlanGroup
.
objects
.
create
()
vlangroup
=
VlanGroup
()
errors
=
{}
vlangroup
.
name
=
data
[
'name'
]
vlangroup
.
description
=
data
[
'description'
]
...
...
@@ -652,15 +652,15 @@ def save_vlangroup(request):
if
len
(
errors
)
>
0
:
return
HttpResponse
(
json
.
dumps
(
errors
),
content_type
=
'application/json'
,
status
=
400
)
vlangroup
.
save
()
return
HttpResponse
(
'KTHXBYE'
)
return
HttpResponse
(
vlangroup
.
id
)
@user_passes_test
(
req_staff
)
def
save_hostgroup
(
request
):
data
=
json
.
loads
(
request
.
body
)
if
data
[
'id'
]:
if
'id'
in
data
and
data
[
'id'
]:
hostgroup
=
get_object_or_404
(
Group
,
id
=
data
[
'id'
])
else
:
hostgroup
=
Group
.
objects
.
create
()
hostgroup
=
Group
()
errors
=
{}
hostgroup
.
name
=
data
[
'name'
]
hostgroup
.
description
=
data
[
'description'
]
...
...
@@ -672,15 +672,15 @@ def save_hostgroup(request):
if
len
(
errors
)
>
0
:
return
HttpResponse
(
json
.
dumps
(
errors
),
content_type
=
'application/json'
,
status
=
400
)
hostgroup
.
save
()
return
HttpResponse
(
'KTHXBYE'
)
return
HttpResponse
(
hostgroup
.
id
)
@user_passes_test
(
req_staff
)
def
save_domain
(
request
):
data
=
json
.
loads
(
request
.
body
)
if
data
[
'id'
]:
if
'id'
in
data
and
data
[
'id'
]:
domain
=
get_object_or_404
(
Domain
,
id
=
data
[
'id'
])
else
:
domain
=
Domain
.
objects
.
create
()
domain
=
Domain
()
errors
=
{}
domain
.
name
=
data
[
'name'
]
domain
.
ttl
=
data
[
'ttl'
]
...
...
@@ -693,12 +693,12 @@ def save_domain(request):
if
len
(
errors
)
>
0
:
return
HttpResponse
(
json
.
dumps
(
errors
),
content_type
=
'application/json'
,
status
=
400
)
domain
.
save
()
return
HttpResponse
(
'KTHXBYE'
)
return
HttpResponse
(
domain
.
id
)
@user_passes_test
(
req_staff
)
def
save_record
(
request
):
data
=
json
.
loads
(
request
.
body
)
if
data
[
'id'
]:
if
'id'
in
data
and
data
[
'id'
]:
record
=
get_object_or_404
(
Record
,
id
=
data
[
'id'
])
else
:
record
=
Record
.
objects
.
create
()
...
...
@@ -715,7 +715,7 @@ def save_record(request):
if
len
(
errors
)
>
0
:
return
HttpResponse
(
json
.
dumps
(
errors
),
content_type
=
'application/json'
,
status
=
400
)
record
.
save
()
return
HttpResponse
(
'KTHXBYE'
)
return
HttpResponse
(
record
.
id
)
@user_passes_test
(
req_staff
)
def
delete_entity
(
request
,
name
,
id
):
...
...
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