Adjustments to admin.py for view, fix Role using charfield as primary key, adjusted openstack/managers.py to fill the charfield instead of the pk
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 741271c..a429520 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -41,16 +41,13 @@
class UserInline(admin.TabularInline):
model = User
+ fields = ['email', 'firstname', 'lastname']
extra = 0
class SliceInline(admin.TabularInline):
model = Slice
extra = 0
-class UserInline(admin.TabularInline):
- model = User
- extra = 0
-
class RoleInline(admin.TabularInline):
model = Role
extra = 0
@@ -230,7 +227,7 @@
class SliceAdmin(OSModelAdmin):
fields = ['name', 'site', 'serviceClass', 'description', 'slice_url']
list_display = ('name', 'site','serviceClass', 'slice_url')
- inlines = [SliverInline]
+ inlines = [SliverInline, SliceMembershipInline]
def queryset(self, request):
# admins can see all keys. Users can only see slices they belong to.
diff --git a/planetstack/core/models/role.py b/planetstack/core/models/role.py
index e7d31b9..d3c577d 100644
--- a/planetstack/core/models/role.py
+++ b/planetstack/core/models/role.py
@@ -7,7 +7,7 @@
class Role(PlCoreBase):
#ROLE_CHOICES = (('admin', 'Admin'), ('pi', 'Principle Investigator'), ('user','User'))
- role_id = models.CharField(max_length=256, unique=True)
+ role = models.CharField(null=True, blank=True,max_length=256, unique=True)
role_type = models.CharField(max_length=80, unique=True)
def __unicode__(self): return u'%s' % (self.role_type)
diff --git a/planetstack/core/serializers.py b/planetstack/core/serializers.py
index 7c5dca9..bc4dd01 100644
--- a/planetstack/core/serializers.py
+++ b/planetstack/core/serializers.py
@@ -10,6 +10,7 @@
model = Role
fields = ('id',
'role_id',
+ 'role',
'role_type')
diff --git a/planetstack/openstack/manager.py b/planetstack/openstack/manager.py
index 166ad19..788699b 100644
--- a/planetstack/openstack/manager.py
+++ b/planetstack/openstack/manager.py
@@ -61,14 +61,14 @@
@require_enabled
def save_role(self, role):
- if not role.role_id:
+ if not role.role:
keystone_role = self.driver.create_role(role.role_type)
- role.role_id = keystone_role.id
+ role.role = keystone_role.id
@require_enabled
def delete_role(self, role):
- if role.role_id:
- self.driver.delete_role({'id': role.role_id})
+ if role.role:
+ self.driver.delete_role({'id': role.role})
@require_enabled
def save_key(self, key):