Commit 5dfb3014 by Őry Máté

one: make default template name unique

parent 8ac3399f
......@@ -16,8 +16,8 @@
<ul>
<li>
<label for="new-template-name">{% trans "Name" %}</label>
<input type="text" name="name" id="new-template-name" value="{{base.name}}"
class="error validated" title="{% trans "Please choose a different name." %}" />
<input type="text" name="name" id="new-template-name" value="{{base.name}} {{maxshare}}"
class="validated" />
<div class="clear"></div>
</li>
<li class="new-tpl-size">
......
......@@ -132,9 +132,14 @@ class AjaxTemplateWizard(View):
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:
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, {
'sizes': InstanceType.objects.all(),
'base': base,
'maxshare': maxshare,
}))
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