2 from django.db import models
3 from core.models import PlCoreBase
5 # Create your models here.
7 class PlanetStack(PlCoreBase):
8 description = models.CharField(max_length=200, unique=True, default="PlanetStack", help_text="Used for scoping of roles at the PlanetStack Application level")
11 verbose_name_plural = "PlanetStack"
14 def __unicode__(self): return u'%s' % (self.description)
16 class PlanetStackRole(PlCoreBase):
17 ROLE_CHOICES = (('admin','Admin'),)
18 role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
20 def __unicode__(self): return u'%s' % (self.role)
22 class PlanetStackPrivilege(PlCoreBase):
23 user = models.ForeignKey('User', related_name='planetstack_privileges')
24 planetstack = models.ForeignKey('PlanetStack', related_name='planetstack_privileges', default=1)
25 role = models.ForeignKey('PlanetStackRole')
27 def __unicode__(self): return u'%s %s %s' % (self.planetstack, self.user, self.role)