Commit 0e7d8bb6 by Kálmán Viktor

dashboard: link parent in tempate form

previous way was kinda ugly
parent 75c9b228
...@@ -23,18 +23,15 @@ ...@@ -23,18 +23,15 @@
{% csrf_token %} {% csrf_token %}
{{ form.name|as_crispy_field }} {{ form.name|as_crispy_field }}
<a {% if form.parent.value %}
href="{% url "dashboard.views.template-detail" pk=form.parent.value %}" <strong>{% trans "Parent template" %}:</strong>
{% else %} {% if parent %}
disabled %} <a href="{% url "dashboard.views.template-detail" pk=parent.pk %}">
{% endif %} {{ parent.name }}
class="btn btn-default pull-right" style="margin-top: 24px;"> </a>
{% trans "Visit" %} {% else %}
<i class="fa fa-arrow-circle-right"></i> -
</a> {% endif %}
<div style="width: 80%;">
{{ form.parent|as_crispy_field }}
</div>
<fieldset class="resources-sliders"> <fieldset class="resources-sliders">
<legend>{% trans "Resource configuration" %}</legend> <legend>{% trans "Resource configuration" %}</legend>
......
...@@ -300,6 +300,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView): ...@@ -300,6 +300,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
context['disks'] = obj.disks.all() context['disks'] = obj.disks.all()
context['is_owner'] = obj.has_level(self.request.user, 'owner') context['is_owner'] = obj.has_level(self.request.user, 'owner')
context['aclform'] = AclUserOrGroupAddForm() context['aclform'] = AclUserOrGroupAddForm()
context['parent'] = obj.parent
return context return context
def get_success_url(self): def get_success_url(self):
......
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