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
813d650d
authored
Feb 28, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webui: unique tpl name check in get parameter
parent
35403787
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
cloud/urls.py
+1
-1
one/templates/new-template-flow.html
+2
-2
one/views.py
+2
-1
No files found.
cloud/urls.py
View file @
813d650d
...
...
@@ -51,7 +51,7 @@ urlpatterns = patterns('',
url
(
r'^ajax/key/delete/$'
,
'one.views.key_ajax_delete'
,
),
url
(
r'^ajax/key/reset/$'
,
'one.views.key_ajax_reset'
,
),
url
(
r'^ajax/template/delete/$'
,
'one.views.ajax_template_delete'
,
),
url
(
r'^ajax/template_name_unique/
(?P<name>.*)
$'
,
url
(
r'^ajax/template_name_unique/$'
,
'one.views.ajax_template_name_unique'
,
),
url
(
r'^reload/$'
,
'firewall.views.reload_firewall'
,
),
...
...
one/templates/new-template-flow.html
View file @
813d650d
...
...
@@ -75,7 +75,7 @@
var
s
=
$
(
self
).
val
();
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'
/ajax/template_name_unique/
'
+
s
,
'url'
:
'
{% one.views.ajax_template_name_unique %}?name=
'
+
s
,
'success'
:
function
(
data
,
b
,
c
)
{
if
(
s
!=
$
(
"#new-template-name"
).
val
())
{
return
true
;
...
...
@@ -99,7 +99,7 @@
e
.
preventDefault
();
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'
/ajax/template_name_unique/
'
+
$
(
"#new-template-name"
).
val
(),
'url'
:
'
{% one.views.ajax_template_name_unique %}?name=
'
+
$
(
"#new-template-name"
).
val
(),
'success'
:
function
(
data
,
b
,
c
)
{
if
(
data
==
"True"
)
{
$
(
"#template-wizard"
).
unbind
(
'submit'
).
submit
()
...
...
one/views.py
View file @
813d650d
...
...
@@ -84,7 +84,8 @@ def ajax_template_delete(request):
else
:
return
HttpResponse
(
unicode
(
_
(
"Unexpected error happened."
)),
status
=
404
)
def
ajax_template_name_unique
(
request
,
name
):
def
ajax_template_name_unique
(
request
):
name
=
request
.
GET
[
'name'
]
s
=
"True"
if
Template
.
objects
.
filter
(
name
=
name
)
.
exists
():
s
=
"False"
...
...
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