Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
4e2f795e
Commit
4e2f795e
authored
Oct 01, 2017
by
LEVY-FALK Hugo
Committed by
root
Oct 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppression de liste de ports.
parent
9ae9a840
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
machines/templates/machines/index_portlist.html
machines/templates/machines/index_portlist.html
+1
-3
machines/urls.py
machines/urls.py
+1
-0
machines/views.py
machines/views.py
+22
-1
No files found.
machines/templates/machines/index_portlist.html
View file @
4e2f795e
...
...
@@ -26,9 +26,7 @@
<td>
{% for p in pl.udp_ports_in %}{{p.show_port}}, {%endfor%}
</td>
<td>
{% for p in pl.udp_ports_out %}{{p.show_port}}, {%endfor%}
</td>
<td
class=
"text-right"
>
{%comment%}
{% include 'buttons/suppr.html' href='machines:del-portlist' id=pl.id %}
{%endcomment%}
{% include 'buttons/suppr.html' with href='machines:del-portlist' id=pl.id %}
{% include 'buttons/edit.html' with href='machines:edit-portlist' id=pl.id %}
</td>
</tr>
...
...
machines/urls.py
View file @
4e2f795e
...
...
@@ -94,4 +94,5 @@ urlpatterns = [
url
(
r
'^rest/service_servers/$'
,
views
.
service_servers
,
name
=
'service-servers'
),
url
(
r
'index_portlist/$'
,
views
.
index_portlist
,
name
=
'index-portlist'
),
url
(
r
'^edit_portlist/(?P<pk>[0-9]+)$'
,
views
.
edit_portlist
,
name
=
'edit-portlist'
),
url
(
r
'^del_portlist/(?P<pk>[0-9]+)$'
,
views
.
del_portlist
,
name
=
'del-portlist'
),
]
machines/views.py
View file @
4e2f795e
...
...
@@ -922,7 +922,11 @@ def index_portlist(request):
@
login_required
@
permission_required
(
'bureau'
)
def
edit_portlist
(
request
,
pk
):
port_list_instance
=
get_object_or_404
(
PortList
,
pk
=
pk
)
try
:
port_list_instance
=
PortList
.
objects
.
get
(
pk
=
pk
)
except
PortList
.
DoesNotExist
:
messages
.
error
(
request
,
"Liste de ports inexistante"
)
return
redirect
(
"/machines/index_portlist/"
)
port_list
=
EditPortListForm
(
request
.
POST
or
None
,
instance
=
port_list_instance
)
if
port_list
.
is_valid
():
with
transaction
.
atomic
(),
reversion
.
create_revision
():
...
...
@@ -931,6 +935,23 @@ def edit_portlist(request, pk):
return
redirect
(
"/machines/index_portlist/"
)
return
form
({
'machineform'
:
port_list
},
'machines/machine.html'
,
request
)
@
login_required
@
permission_required
(
'bureau'
)
def
del_portlist
(
request
,
pk
):
try
:
port_list_instance
=
PortList
.
objects
.
get
(
pk
=
pk
)
except
PortList
.
DoesNotExist
:
messages
.
error
(
request
,
"Liste de ports inexistante"
)
return
redirect
(
"/machines/index_portlist/"
)
if
port_list_instance
.
interfaces
.
all
():
messages
.
error
(
request
,
"Cette liste de ports est utilisée"
)
return
redirect
(
"/machines/index_portlist/"
)
port_list_instance
.
delete
()
messages
.
success
(
request
,
"La liste de ports a été supprimée"
)
return
redirect
(
"/machines/index_portlist/"
)
""" Framework Rest """
class
JSONResponse
(
HttpResponse
):
...
...
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