131 class Request(models.Model): |
131 class Request(models.Model): |
132 |
132 |
133 sent_to = models.ManyToManyField(User, related_name = "%(class)s_sent_to", blank = False) |
133 sent_to = models.ManyToManyField(User, related_name = "%(class)s_sent_to", blank = False) |
134 sent_by = models.ForeignKey(User, related_name = "%(class)s_sent_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) |
|
137 reply = models.BooleanField(default = False) |
136 reply = models.BooleanField(default = False) |
138 is_read = models.BooleanField(default = False) |
137 is_read = models.BooleanField(default = False) |
139 creation_date = models.DateTimeField() |
138 creation_date = models.DateTimeField() |
140 reply_date = models.DateTimeField() |
139 reply_date = models.DateTimeField() |
141 is_replied = models.BooleanField(default = False) |
140 is_replied = models.BooleanField(default = False) |
142 replied_by = models.ForeignKey(User, related_name = "%(class)s_replied_by", blank = False) |
141 replied_by = models.ForeignKey(User, related_name = "%(class)s_replied_by", blank = True, null = True) |
143 task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True) |
142 task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True) |
144 receiving_user = models.ForeignKey(User, related_name = "%(class)s_receiving_user", blank = True, null = True) |
143 receiving_user = models.ForeignKey(User, related_name = "%(class)s_receiving_user", blank = True, null = True) |
145 pynts = models.PositiveIntegerField(default=0) |
144 pynts = models.PositiveIntegerField(default=0) |
146 |
145 |
147 def __unicode__(self): |
146 def __unicode__(self): |
148 |
147 |
149 return u"Request %s %s"%(self.by.username, self.role) |
148 return u"Request %s %s"%(self.sent_by.username, self.role) |
150 |
149 |
151 class Notification(models.Model): |
150 class Notification(models.Model): |
152 |
151 |
153 to = models.ManyToManyField(User, related_name = "%(class)s_to", blank = False) |
152 to = models.ManyToManyField(User, related_name = "%(class)s_to", blank = False) |
154 is_read = models.BooleanField(default = False) |
153 is_read = models.BooleanField(default = False) |