pytask/profile/models.py
changeset 403 61292fa7f61a
parent 329 5b121925d7f5
child 438 f861c753e55a
equal deleted inserted replaced
402:b8ca16f03916 403:61292fa7f61a
     3 from django.contrib.auth.models import User
     3 from django.contrib.auth.models import User
     4 
     4 
     5 GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
     5 GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
     6 
     6 
     7 RIGHTS_CHOICES = (
     7 RIGHTS_CHOICES = (
     8 	("DC", "Director"),
     8   ("DC", "Director"),
     9 	("MG", "Manager"),
     9   ("MG", "Manager"),
    10         ("CR", "Co-ordinator"),
    10   ("CR", "Co-ordinator"),
    11 	("CT", "Contributor"),)
    11   ("CT", "Contributor"),)
    12 
    12 
    13 ROLE_CHOICES = (
    13 ROLE_CHOICES = (
    14 	("DC", "Request sent by Director \
    14   ("DC", "Request sent by Director \
    15                 to a user at lower level, asking him to act as a director"),
    15                 to a user at lower level, asking him to act as a director"),
    16 	("MG", "Request sent by Manager \
    16   ("MG", "Request sent by Manager \
    17                 to a user at lower level, asking him to act as a manager"),)
    17                 to a user at lower level, asking him to act as a manager"),)
    18 
    18 
    19 class Profile(models.Model):
    19 class Profile(models.Model):
    20     
       
    21     uniq_key = models.CharField(max_length=20)
       
    22 
       
    23     full_name = models.CharField(max_length=50, verbose_name="Name as on bank\
    20     full_name = models.CharField(max_length=50, verbose_name="Name as on bank\
    24                                  account", help_text="Any DD/Cheque will be\
    21                                  account", help_text="Any DD/Cheque will be\
    25                                  issued on this name")
    22                                  issued on this name")
    26     user = models.ForeignKey(User, unique = True)
    23     user = models.ForeignKey(User, unique = True)
    27     rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    24     rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    44     """ A model to hold notifications.
    41     """ A model to hold notifications.
    45     All these are sent by the site to users.
    42     All these are sent by the site to users.
    46     Hence there is no sent_from option.
    43     Hence there is no sent_from option.
    47     """
    44     """
    48 
    45 
    49     uniq_key = models.CharField(max_length=20)
       
    50 
       
    51     sent_to = models.ForeignKey(User, related_name = "%(class)s_sent_to", blank = False)
    46     sent_to = models.ForeignKey(User, related_name = "%(class)s_sent_to", blank = False)
    52 
    47 
    53     subject = models.CharField(max_length=100, blank=True)
    48     subject = models.CharField(max_length=100, blank=True)
    54     message = models.TextField()
    49     message = models.TextField()
    55 
    50 
    60 class RoleRequest(models.Model):
    55 class RoleRequest(models.Model):
    61     """ A request sent by one user to the other.
    56     """ A request sent by one user to the other.
    62     Typically requesting to raise one's status.
    57     Typically requesting to raise one's status.
    63     """
    58     """
    64 
    59 
    65     uniq_key = models.CharField(max_length=20)
       
    66     role = models.CharField(max_length=2, choices=ROLE_CHOICES)
    60     role = models.CharField(max_length=2, choices=ROLE_CHOICES)
    67     is_accepted = models.BooleanField(default=False)
    61     is_accepted = models.BooleanField(default=False)
    68 
    62 
    69     message = models.TextField()
    63     message = models.TextField()
    70     response = models.TextField()
    64     response = models.TextField()
    72     sent_from = models.ForeignKey(User, related_name = "%(class)s_sent_from", null = True, blank = True)
    66     sent_from = models.ForeignKey(User, related_name = "%(class)s_sent_from", null = True, blank = True)
    73 
    67 
    74     sent_date = models.DateTimeField()
    68     sent_date = models.DateTimeField()
    75     is_read = models.BooleanField(default = False)
    69     is_read = models.BooleanField(default = False)
    76     is_deleted = models.BooleanField(default = False)
    70     is_deleted = models.BooleanField(default = False)
    77