Hopefully fix TenantPrilegeInline
diff --git a/xos/core/admin.py b/xos/core/admin.py
index b71e6c3..b0bc0d4 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -1,29 +1,28 @@
-from core.models import Site
-from core.models import *
-from openstack.manager import OpenStackManager
+import threading
+from cgi import escape as html_escape
-from django.contrib import admin
-from django.contrib.auth.models import Group
+from core.models import *
+from core.models import Site
from django import forms
-from django.utils.safestring import mark_safe
+from django.contrib import admin, messages
+from django.contrib.admin.widgets import (AdminTextareaWidget,
+ FilteredSelectMultiple)
from django.contrib.auth.admin import UserAdmin
-from django.contrib.admin.widgets import FilteredSelectMultiple, AdminTextareaWidget
-from django.contrib.auth.forms import ReadOnlyPasswordHashField, AdminPasswordChangeForm
+from django.contrib.auth.forms import (AdminPasswordChangeForm,
+ ReadOnlyPasswordHashField)
+from django.contrib.auth.models import Group
from django.contrib.auth.signals import user_logged_in
-from django.utils import timezone
from django.contrib.contenttypes import generic
-from suit.widgets import LinkedSelect
-from django.core.exceptions import PermissionDenied
-from django.core.urlresolvers import reverse, resolve, NoReverseMatch
+from django.core.exceptions import PermissionDenied, ValidationError
+from django.core.urlresolvers import NoReverseMatch, resolve, reverse
+from django.forms.utils import flatatt, to_current_timezone
+from django.utils import timezone
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import conditional_escape, format_html
+from django.utils.safestring import mark_safe
from django.utils.text import capfirst
-from django.forms.utils import flatatt, to_current_timezone
-from django.core.exceptions import PermissionDenied, ValidationError
-from cgi import escape as html_escape
-from django.contrib import messages
-
-import threading
+from openstack.manager import OpenStackManager
+from suit.widgets import LinkedSelect
# thread locals necessary to work around a django-suit issue
_thread_locals = threading.local()
@@ -879,16 +878,6 @@
def queryset(self, request):
return TenantRootPrivilege.select_by_user(request.user)
-class TenantPrivilegeInline(XOSTabularInline):
- model = TenantPrivilege
- extra = 0
- suit_classes = 'suit-tab suit-tab-tenantprivileges'
- fields = ['backend_status_icon', 'user', 'role', 'tenant']
- readonly_fields = ('backend_status_icon', )
-
- def queryset(self, request):
- return TenantPrivilege.select_by_user(request.user)
-
class TenantRootAdmin(XOSBaseAdmin):
model = TenantRoot
list_display = ('backend_status_icon', 'name', 'kind')
@@ -903,6 +892,20 @@
('tenantrootprivileges','Privileges')
)
+class TenantRoleAdmin(XOSBaseAdmin):
+ model = TenantRole
+ fields = ('role',)
+
+class TenantPrivilegeInline(XOSTabularInline):
+ model = TenantPrivilege
+ extra = 0
+ suit_classes = 'suit-tab suit-tab-tenantprivileges'
+ fields = ['backend_status_icon', 'user', 'role', 'tenant']
+ readonly_fields = ('backend_status_icon', )
+
+ def queryset(self, request):
+ return TenantPrivilege.select_by_user(request.user)
+
class ProviderTenantInline(XOSTabularInline):
model = CoarseTenant
fields = ['provider_service', 'subscriber_service', 'connect_method']