blob: 4e835d0fde7ed55ee0f752789a05efca525a9342 [file] [log] [blame]
Siobhan Tully4bc09f22013-04-10 21:15:21 -04001import os
2from django.db import models
Siobhan Tully30fd4292013-05-10 08:59:56 -04003from core.models import PlCoreBase
Siobhan Tullybfd11dc2013-09-03 12:59:24 -04004from core.models import Member
5from django.contrib.contenttypes import generic
Siobhan Tully4bc09f22013-04-10 21:15:21 -04006
7# Create your models here.
8
Siobhan Tullybf1153a2013-05-27 20:53:48 -04009class Deployment(PlCoreBase):
10 name = models.CharField(max_length=200, unique=True, help_text="Name of the Deployment")
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040011 members = generic.GenericRelation(Member)
Siobhan Tully4bc09f22013-04-10 21:15:21 -040012
13 def __unicode__(self): return u'%s' % (self.name)
14
Siobhan Tullybfd11dc2013-09-03 12:59:24 -040015
16class DeploymentRole(PlCoreBase):
17
18 ROLE_CHOICES = (('admin','Admin'),)
19 role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
20
21 def __unicode__(self): return u'%s' % (self.role)
22
23class DeploymentPrivilege(PlCoreBase):
24
25 user = models.ForeignKey('User', related_name='deployment_privileges')
26 deployment = models.ForeignKey('Deployment', related_name='deployment_privileges')
27 role = models.ForeignKey('DeploymentRole')
28
29 def __unicode__(self): return u'%s %s %s' % (self.deployment, self.user, self.role)
30