Commit 5dfb3014 by Őry Máté

one: make default template name unique

parent 8ac3399f
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<ul> <ul>
<li> <li>
<label for="new-template-name">{% trans "Name" %}</label> <label for="new-template-name">{% trans "Name" %}</label>
<input type="text" name="name" id="new-template-name" value="{{base.name}}" <input type="text" name="name" id="new-template-name" value="{{base.name}} {{maxshare}}"
class="error validated" title="{% trans "Please choose a different name." %}" /> class="validated" />
<div class="clear"></div> <div class="clear"></div>
</li> </li>
<li class="new-tpl-size"> <li class="new-tpl-size">
......
...@@ -132,9 +132,14 @@ class AjaxTemplateWizard(View): ...@@ -132,9 +132,14 @@ class AjaxTemplateWizard(View):
base = get_object_or_404(Template, id=request.POST['base']) base = get_object_or_404(Template, id=request.POST['base'])
if base.owner != request.user and not base.public and not request.user.is_superuser: if base.owner != request.user and not base.public and not request.user.is_superuser:
raise PermissionDenied() raise PermissionDenied()
try:
maxshare = Template.objects.order_by('-pk')[0].pk + 1
except:
maxshare = 1
return render_to_response('new-template-flow.html', RequestContext(request, { return render_to_response('new-template-flow.html', RequestContext(request, {
'sizes': InstanceType.objects.all(), 'sizes': InstanceType.objects.all(),
'base': base, 'base': base,
'maxshare': maxshare,
})) }))
ajax_template_wizard = login_required(AjaxTemplateWizard.as_view()) ajax_template_wizard = login_required(AjaxTemplateWizard.as_view())
......
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