taskapp/models.py
changeset 85 9cf299c47990
parent 83 fd2e1bd7af82
child 86 fcbdf372857c
equal deleted inserted replaced
84:3e75ed940408 85:9cf299c47990
   128     message = models.TextField()
   128     message = models.TextField()
   129     creation_datetime = models.DateTimeField()
   129     creation_datetime = models.DateTimeField()
   130 
   130 
   131 class Request(models.Model):
   131 class Request(models.Model):
   132 
   132 
   133     to = models.ManyToManyField(User, related_name = "%(class)s_to", blank = False)
   133     sent_to = models.ManyToManyField(User, related_name = "%(class)s_sent_to", blank = False)
   134     by = models.ForeignKey(User, related_name = "%(class)s_by", blank = False)
   134     sent_by = models.ForeignKey(User, related_name = "%(class)s_sent_by", blank = False)
   135     role = models.CharField(max_length = 2, blank = False)
   135     role = models.CharField(max_length = 2, blank = False)
   136     is_active = models.BooleanField(default = True)
   136     is_active = models.BooleanField(default = True)
   137     reply = models.BooleanField(default = False)
   137     reply = models.BooleanField(default = False)
   138     read = models.BooleanField(default = False)
   138     is_read = models.BooleanField(default = False)
   139     creation_date = models.DateTimeField()
   139     creation_date = models.DateTimeField()
   140     reply_date = models.DateTimeField()
   140     reply_date = models.DateTimeField()
   141     replied = models.BooleanField(default = False)
   141     is_replied = models.BooleanField(default = False)
       
   142     replied_by = models.ForeignKey(User, related_name = "%(class)s_replied_by", blank = False)
   142     task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True)
   143     task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True)
   143     assigned_user = models.ForeignKey(User, related_name = "%(class)s_assigned_user", blank = True, null = True)
   144     receiving_user = models.ForeignKey(User, related_name = "%(class)s_receiving_user", blank = True, null = True)
   144     pynts = models.PositiveIntegerField(default=0)
   145     pynts = models.PositiveIntegerField(default=0)
   145 
   146 
   146     def __unicode__(self):
   147     def __unicode__(self):
   147 
   148 
   148         return u"Request %s %s"%(self.by.username, self.role)
   149         return u"Request %s %s"%(self.by.username, self.role)