| import os |
| from django.db import models |
| from core.models import PlCoreBase |
| from django.contrib.contenttypes import generic |
| |
| # Create your models here. |
| |
| class Deployment(PlCoreBase): |
| name = models.CharField(max_length=200, unique=True, help_text="Name of the Deployment") |
| |
| def __unicode__(self): return u'%s' % (self.name) |
| |
| |
| class DeploymentRole(PlCoreBase): |
| |
| ROLE_CHOICES = (('admin','Admin'),) |
| role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30) |
| krole_id = models.CharField(max_length=80, verbose_name="Keystone role id", null=True, blank=True) |
| |
| def __unicode__(self): return u'%s' % (self.role) |
| |
| class DeploymentPrivilege(PlCoreBase): |
| |
| user = models.ForeignKey('User', related_name='deployment_privileges') |
| deployment = models.ForeignKey('Deployment', related_name='deployment_privileges') |
| role = models.ForeignKey('DeploymentRole') |
| |
| def __unicode__(self): return u'%s %s %s' % (self.deployment, self.user, self.role) |
| |