Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 1 | import os |
| 2 | import datetime |
| 3 | from django.db import models |
Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame] | 4 | from core.models import PlCoreBase |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 5 | from django.contrib.contenttypes.models import ContentType |
| 6 | from django.contrib.contenttypes import generic |
Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 7 | |
| 8 | class Role(PlCoreBase): |
| 9 | |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 10 | role_type = models.CharField(max_length=80, verbose_name="Name") |
Tony Mack | 7665f81 | 2013-10-07 22:55:16 -0400 | [diff] [blame] | 11 | role = models.CharField(max_length=80, verbose_name="Keystone role id", null=True, blank=True) |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 12 | description = models.CharField(max_length=120, verbose_name="Description") |
| 13 | content_type = models.ForeignKey(ContentType, verbose_name="Role Scope") |
Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 14 | |
Siobhan Tully | bfd11dc | 2013-09-03 12:59:24 -0400 | [diff] [blame] | 15 | def __unicode__(self): return u'%s:%s' % (self.content_type,self.role_type) |
Siobhan Tully | 4bc09f2 | 2013-04-10 21:15:21 -0400 | [diff] [blame] | 16 | |
Tony Mack | fd24d0d | 2013-04-14 00:59:17 -0400 | [diff] [blame] | 17 | |
| 18 | def save(self, *args, **kwds): |
Tony Mack | fd24d0d | 2013-04-14 00:59:17 -0400 | [diff] [blame] | 19 | super(Role, self).save(*args, **kwds) |
| 20 | |
| 21 | def delete(self, *args, **kwds): |
Tony Mack | fd24d0d | 2013-04-14 00:59:17 -0400 | [diff] [blame] | 22 | super(Role, self).delete(*args, **kwds) |
| 23 | |