Commit 28fb75ef by Kálmán Viktor

dashboard: warn the user about not having leases when creating new template

parent da3cefe3
{% load i18n %}
{% load crispy_forms_tags %}
{% if leases < 1 %}
<div class="alert alert-warning">
{% trans "You haven't created any leases yet, but you need one ot create a template!" %}
<a href="{% url "dashboard.views.lease-create" %}">{% trans "Create a new lease now." %}</a>
</div>
{% endif %}
{% with form=form %}
{% include "display-form-errors.html" %}
{% endwith %}
......
......@@ -878,8 +878,6 @@ class TemplateClone(CreateView):
class TemplateCreate(SuccessMessageMixin, CreateView):
model = InstanceTemplate
form_class = TemplateForm
template_name = "dashboard/template-create.html"
success_message = _("Successfully created a new template!")
def get_template_names(self):
if self.request.is_ajax():
......@@ -894,6 +892,7 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
'box_title': _("Create a new base VM"),
'ajax_title': False,
'template': "dashboard/_template-create-2.html",
'leases': Lease.objects.count()
})
return context
......
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