taskapp/views/task.py
changeset 176 13ceb76fd0a3
parent 167 b61e45074ba1
child 177 4a7206176345
equal deleted inserted replaced
175:10a488a6fbba 176:13ceb76fd0a3
   102     elif task.status == "WR":
   102     elif task.status == "WR":
   103         context['assigned_users'] = task.assigned_users.all()
   103         context['assigned_users'] = task.assigned_users.all()
   104    
   104    
   105     if request.method == 'POST':
   105     if request.method == 'POST':
   106         if not is_guest:
   106         if not is_guest:
   107             data = request.POST["data"]
   107             data = request.POST.get("data", "").strip()
       
   108             if not data:
       
   109                 context['error_msg'] = "Enter some message to comment"
       
   110                 return render_to_response('task/view.html', context)
   108             new_comment = Comment(task=task, data=data, created_by=user, creation_datetime=datetime.now())
   111             new_comment = Comment(task=task, data=data, created_by=user, creation_datetime=datetime.now())
   109             new_comment.save()
   112             new_comment.save()
   110             return redirect(task_url)
   113             return redirect(task_url)
   111         else:
   114         else:
   112             errors.append("You must be logged in to post a comment")
   115             errors.append("You must be logged in to post a comment")