diff --git a/django-openstack/django_openstack/syspanel/views/tenants.py b/django-openstack/django_openstack/syspanel/views/tenants.py index 271cf1857..cf72d830a 100644 --- a/django-openstack/django_openstack/syspanel/views/tenants.py +++ b/django-openstack/django_openstack/syspanel/views/tenants.py @@ -59,7 +59,7 @@ class AddUser(forms.SelfHandlingForm): except api_exceptions.ApiException, e: messages.error(request, 'Unable to create user association: %s' % (e.message)) - return redirect('syspanel_tenants') + return redirect('syspanel_tenant_users', tenant_id=data['tenant']) class RemoveUser(forms.SelfHandlingForm): @@ -79,7 +79,7 @@ class RemoveUser(forms.SelfHandlingForm): except api_exceptions.ApiException, e: messages.error(request, 'Unable to create tenant: %s' % (e.message)) - return redirect('syspanel_tenants') + return redirect('syspanel_tenant_users', tenant_id=data['tenant']) class CreateTenant(forms.SelfHandlingForm): @@ -243,22 +243,15 @@ def users(request, tenant_id): users = api.account_api(request).users.get_for_tenant(tenant_id) all_users = api.account_api(request).users.list() - new_user_ids = [] user_ids = [u.id for u in users] - all_user_ids = [u.id for u in all_users] - for uid in all_user_ids: - if not uid in user_ids: - new_user_ids.append(uid) - for i in user_ids: - if i in new_user_ids: - new_user_ids.remove(i) + new_users = [u for u in all_users if not u.id in user_ids] return render_to_response( 'django_openstack/syspanel/tenants/users.html', { 'add_user_form': add_user_form, 'remove_user_form': remove_user_form, 'tenant_id': tenant_id, 'users': users, - 'new_users': new_user_ids, + 'new_users': new_users, }, context_instance=template.RequestContext(request)) diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html index 44f70148b..5893467d7 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html @@ -3,7 +3,7 @@ {% for hidden in form.hidden_fields %} {{hidden}} {% endfor %} - + - + diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html index c77ffde38..b60bac78c 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html @@ -18,6 +18,7 @@ {% if users %} + @@ -26,6 +27,7 @@ {% for user in users %} +
ID Name Email Actions
{{user.id}}{{user.name}} {{user.email}}
    @@ -46,13 +48,15 @@

    Add new users

    + {% for user in new_users %} - + +
    ID Name Actions
    {{user}}{{user.id}}{{user.name}}
    • {% include "django_openstack/syspanel/tenants/_add_user.html" with form=add_user_form %}
    • diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html index d3237c7c4..7b622dfe7 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html @@ -17,6 +17,7 @@ + @@ -24,6 +25,7 @@ {% for user in users %} +
      IDName Email Default Tenant Options
      {{user.id}}{% if not user.enabled %} (disabled){% endif %}{{user.name}} {{user.email}} {{user.tenantId}}