9007a51dba770d811c704f90a19cdcd221fdd1ff
[plstackapi.git] / planetstack / core / models / planetstackspecific.py
1 import os
2 from django.db import models
3 from core.models import PlCoreBase
4
5 # Create your models here.
6
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")
9
10     class Meta:
11         verbose_name_plural = "PlanetStack"
12         app_label = "core"
13
14     def __unicode__(self):  return u'%s' % (self.description)
15
16 class 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
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')
26
27     def __unicode__(self):  return u'%s %s %s' % (self.planetstack, self.user, self.role)
28
29
30