taskapp/models.py
changeset 128 f34e3a3e1439
parent 124 6d92b7cd2a37
child 129 e747da8bc110
equal deleted inserted replaced
127:71888e23f323 128:f34e3a3e1439
    22     ("LO", "Locked"),
    22     ("LO", "Locked"),
    23     ("WR", "Working"),
    23     ("WR", "Working"),
    24     ("CD", "Closed"),
    24     ("CD", "Closed"),
    25     ("DL", "Deleted"),
    25     ("DL", "Deleted"),
    26     ("CM", "Completed"))
    26     ("CM", "Completed"))
       
    27 
       
    28 NOTIFY_CHOICES = (
       
    29     ("MT", "Add Mentor"),
       
    30     ("DV", "Developer"),
       
    31     ("MG", "Manager"),
       
    32     ("AD", "Admin"),
       
    33     ("PY", "Assign credits"),
       
    34     ("CM", "Task completed"),
       
    35     ("CD", "Task closed"),
       
    36     ("DL", "Task deleted"),
       
    37     ("KD", "Kicked off"),
       
    38     ("MS", "Message"),
       
    39 )
       
    40 
    27 
    41 
    28 IMAGES_DIR = "./images"
    42 IMAGES_DIR = "./images"
    29 UPLOADS_DIR = "./uploads"
    43 UPLOADS_DIR = "./uploads"
    30 
    44 
    31 
    45 
   154 
   168 
   155         return u"Request %s %s"%(self.sent_by.username, self.role)
   169         return u"Request %s %s"%(self.sent_by.username, self.role)
   156 
   170 
   157 class Notification(models.Model):
   171 class Notification(models.Model):
   158 
   172 
   159     sent_to = models.ManyToManyField(User, related_name = "%(class)s_sent_to", blank = False)
   173     role = models.CharField(max_length = 2, choices = NOTIFY_CHOICES, blank = False)
   160     sent_from = models.ManyToManyField(User, related_name = "%(class)s_sent_from", blank = True)
   174     sent_to = models.ForeignKey(User, related_name = "%(class)s_sent_to", blank = False)
       
   175     sent_from = models.ForeignKey(User, related_name = "%(class)s_sent_from", blank = True)
       
   176     task = models.ForeignKey(Task, related_name = "%(class)s_sent_for", blank = False)
       
   177 
   161 
   178 
   162     sub = models.CharField(max_length = 100)
   179     sub = models.CharField(max_length = 100)
   163     message = models.TextField()
   180     message = models.TextField()
       
   181     remark = models.CharField(max_length = 100)
   164 
   182 
   165     sent_date = models.DateTimeField()
   183     sent_date = models.DateTimeField()
   166     is_read = models.BooleanField(default = False)
   184     is_read = models.BooleanField(default = False)
   167     is_deleted = models.BooleanField(default = False)
   185     is_deleted = models.BooleanField(default = False)
   168     
   186