Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 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): |
Sapan Bhatia | 6bfa2ca | 2014-11-11 21:47:45 -0500 | [diff] [blame] | 23 | user = models.ForeignKey('User', related_name='planetstackprivileges') |
| 24 | planetstack = models.ForeignKey('PlanetStack', related_name='planetstackprivileges', default=1) |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 25 | role = models.ForeignKey('PlanetStackRole') |
| 26 | |
| 27 | def __unicode__(self): return u'%s %s %s' % (self.planetstack, self.user, self.role) |
| 28 | |
| 29 | |
| 30 | |