Commit 28ee3823 by Szabolcs Gelencser Committed by Szabolcs Gelencsér

Extract role listing to settings.py

parent 9ccc63cf
......@@ -618,3 +618,10 @@ DEFAULT_LEASE_DELETE_SECONDS = 7200
SESSIONHOOK_SHARED_SECRET = "verysecretmuchsecure"
IS_NET_OMISSION_SUPPORTED = False # in mitaka you must specify network at vm creation
ROLES_SHOWN = [
"_member_",
"circle_admin",
"developer",
"researcher",
]
......@@ -580,7 +580,7 @@ class LeaseForm(forms.ModelForm):
if roles:
self.fields['roles'].choices = (
(role.name, role.name) for role in roles
(role, role) for role in roles
)
if self.instance.id:
......
......@@ -444,7 +444,7 @@ class LeaseCreate(LoginRequiredMixin, PolicyMixin,
def get_form_kwargs(self):
from openstack_api import keystone
kwargs = super(LeaseCreate, self).get_form_kwargs()
kwargs['roles'] = keystone.role_list(self.request)
kwargs['roles'] = settings.ROLES_SHOWN
return kwargs
......@@ -462,7 +462,7 @@ class LeaseDetail(LoginRequiredMixin, PolicyMixin,
def get_form_kwargs(self):
from openstack_api import keystone
kwargs = super(LeaseDetail, self).get_form_kwargs()
kwargs['roles'] = keystone.role_list(self.request)
kwargs['roles'] = settings.ROLES_SHOWN
return kwargs
def get_context_data(self, *args, **kwargs):
......
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