blob: 9007a51dba770d811c704f90a19cdcd221fdd1ff [file] [log] [blame]
Siobhan Tullybfd11dc2013-09-03 12:59:24 -04001import os
2from django.db import models
3from core.models import PlCoreBase
4
5# Create your models here.
6
7class 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")
9
10 class Meta:
11 verbose_name_plural = "PlanetStack"
12 app_label = "core"
13
14 def __unicode__(self): return u'%s' % (self.description)
15
16class PlanetStackRole(PlCoreBase):
17 ROLE_CHOICES = (('admin','Admin'),)
18 role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
19
20 def __unicode__(self): return u'%s' % (self.role)
21
22class 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')
26
27 def __unicode__(self): return u'%s %s %s' % (self.planetstack, self.user, self.role)
28
29
30