Commit d92716d6 by Szabolcs Gelencser

Ensure default lease's role selector doesn't show up

parent 48c95e94
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
{% endwith %} {% endwith %}
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<div class="row"> <div class="row container-fluid">
<div class="col-md-7"> <div {% if not is_default %} class="col-md-7" {% endif %}>
{{ form.name|as_crispy_field }} {{ form.name|as_crispy_field }}
<label>Suspend in</label> <label>Suspend in</label>
<div class="input-group interval-input"> <div class="input-group interval-input">
...@@ -42,10 +42,12 @@ ...@@ -42,10 +42,12 @@
<div class="input-group-addon">months</div> <div class="input-group-addon">months</div>
</div> </div>
</div> </div>
{% if not is_default %}
<div class="col-md-5"> <div class="col-md-5">
{{ form.roles }} {{ form.roles }}
</div> </div>
<div class="form-group container-fluid"> {% endif %}
<div class="form-group">
<div class="controls "> <div class="controls ">
<input type="submit" name="submit" value="Save changes" class="btn btn-primary" id="submit-id-submit"> <input type="submit" name="submit" value="Save changes" class="btn btn-primary" id="submit-id-submit">
</div> </div>
......
...@@ -60,6 +60,7 @@ from .util import ( ...@@ -60,6 +60,7 @@ from .util import (
DeleteViewBase, TransferOwnershipConfirmView, TransferOwnershipView) DeleteViewBase, TransferOwnershipConfirmView, TransferOwnershipView)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
from django.conf import settings
class TemplateChoose(LoginRequiredMixin, TemplateView): class TemplateChoose(LoginRequiredMixin, TemplateView):
...@@ -433,6 +434,11 @@ class LeaseDetail(LoginRequiredMixin, PolicyMixin, ...@@ -433,6 +434,11 @@ class LeaseDetail(LoginRequiredMixin, PolicyMixin,
kwargs['roles'] = keystone.role_list(self.request) kwargs['roles'] = keystone.role_list(self.request)
return kwargs return kwargs
def get_context_data(self, *args, **kwargs):
context = super(LeaseDetail, self).get_context_data(*args, **kwargs)
context['is_default'] = settings.DEFAULT_LEASE_NAME == self.object.name
return context
class LeaseDelete(DeleteViewBase): class LeaseDelete(DeleteViewBase):
model = Lease model = Lease
......
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