Commit 813d650d by Őry Máté

webui: unique tpl name check in get parameter

parent 35403787
......@@ -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', ),
......
......@@ -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()
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment