# HG changeset patch # User anoop # Date 1267023825 -19800 # Node ID 0b6d251d3c306ecdd81237e413633d2f9972ce2c # Parent f0a3d6612462cd47a340ebacc6751f26be7f2293# Parent fcbdf372857c40a4272c46d5bc07538683b5eecb merged. diff -r f0a3d6612462 -r 0b6d251d3c30 taskapp/models.py --- a/taskapp/models.py Wed Feb 24 20:32:57 2010 +0530 +++ b/taskapp/models.py Wed Feb 24 20:33:45 2010 +0530 @@ -133,20 +133,19 @@ sent_to = models.ManyToManyField(User, related_name = "%(class)s_sent_to", blank = False) sent_by = models.ForeignKey(User, related_name = "%(class)s_sent_by", blank = False) role = models.CharField(max_length = 2, blank = False) - is_active = models.BooleanField(default = True) reply = models.BooleanField(default = False) is_read = models.BooleanField(default = False) creation_date = models.DateTimeField() reply_date = models.DateTimeField() is_replied = models.BooleanField(default = False) - replied_by = models.ForeignKey(User, related_name = "%(class)s_replied_by", blank = False) + replied_by = models.ForeignKey(User, related_name = "%(class)s_replied_by", blank = True, null = True) task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True) receiving_user = models.ForeignKey(User, related_name = "%(class)s_receiving_user", blank = True, null = True) pynts = models.PositiveIntegerField(default=0) def __unicode__(self): - return u"Request %s %s"%(self.by.username, self.role) + return u"Request %s %s"%(self.sent_by.username, self.role) class Notification(models.Model): diff -r f0a3d6612462 -r 0b6d251d3c30 taskapp/views/user.py --- a/taskapp/views/user.py Wed Feb 24 20:32:57 2010 +0530 +++ b/taskapp/views/user.py Wed Feb 24 20:33:45 2010 +0530 @@ -99,7 +99,7 @@ def browse_requests(request): user = request.user - active_reqs = user.request_to.filter(replied=False) + active_reqs = user.request_sent_to.filter(is_replied=False) reqs = active_reqs.order_by('creation_date').reverse() for pos, req in enumerate(reversed(reqs)): req.pos = pos @@ -117,13 +117,13 @@ """ user = request.user - reqs = user.request_to.filter(replied=False).order_by('creation_date') + reqs = user.request_sent_to.filter(is_replied=False).order_by('creation_date') user_request = reqs[int(rid)] context = { 'user':user, 'req':user_request, - 'sent_users':user_request.to.all() + 'sent_users':user_request.sent_to.all() } return render_to_response('user/view_request.html', context) @@ -137,9 +137,9 @@ if request.method=="POST": user = request.user browse_request_url= '/user/requests' - reqs = user.request_to.filter(replied=False).order_by('creation_date') + reqs = user.request_sent_to.filter(is_replied=False).order_by('creation_date') user_request = reqs[int(rid)] - + return show_msg("Your reply has been processed", browse_request_url, "view other requests") else: return show_msg("You are not authorised to do this", browse_request_url, "view other requests") diff -r f0a3d6612462 -r 0b6d251d3c30 templates/user/browse_requests.html --- a/templates/user/browse_requests.html Wed Feb 24 20:32:57 2010 +0530 +++ b/templates/user/browse_requests.html Wed Feb 24 20:33:45 2010 +0530 @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block content %} {% for req in reqs %} -