Decomposed models.py into models/ with individual files per topic. Added new admin...
[plstackapi.git] / plstackapi / core / models / role.py
1 import os
2 import datetime
3 from django.db import models
4 from plstackapi.core.models import PlCoreBase
5
6 # Create your models here.
7
8 class Role(PlCoreBase):
9
10     ROLE_CHOICES = (('admin', 'Admin'), ('pi', 'Principle Investigator'), ('user','User'))
11     role_id = models.CharField(max_length=256, unique=True)
12     role_type = models.CharField(max_length=80, unique=True, choices=ROLE_CHOICES)
13
14     def __unicode__(self):  return u'%s' % (self.role_type)
15
16     def save(self):
17         if not self.id:
18             self.created = datetime.date.today()
19         self.updated = datetime.datetime.today()
20         super(Role, self).save()