# HG changeset patch
# User nishanth
# Date 1267522428 -19800
# Node ID 13ceb76fd0a362201d0c8b957fd0fb5f4fb6c08e
# Parent 10a488a6fbba26a8f36ac1306e03333b91bba8c6
now empty comments will not be accepted.
diff -r 10a488a6fbba -r 13ceb76fd0a3 taskapp/views/task.py
--- a/taskapp/views/task.py Tue Mar 02 14:51:59 2010 +0530
+++ b/taskapp/views/task.py Tue Mar 02 15:03:48 2010 +0530
@@ -104,7 +104,10 @@
if request.method == 'POST':
if not is_guest:
- data = request.POST["data"]
+ data = request.POST.get("data", "").strip()
+ if not data:
+ context['error_msg'] = "Enter some message to comment"
+ return render_to_response('task/view.html', context)
new_comment = Comment(task=task, data=data, created_by=user, creation_datetime=datetime.now())
new_comment.save()
return redirect(task_url)
diff -r 10a488a6fbba -r 13ceb76fd0a3 templates/task/view.html
--- a/templates/task/view.html Tue Mar 02 14:51:59 2010 +0530
+++ b/templates/task/view.html Tue Mar 02 15:03:48 2010 +0530
@@ -136,12 +136,15 @@
{% for comment in comments %}
{{ comment.created_by.username }}
on {{ comment.creation_datetime|date:"D d M Y"}} at {{comment.creation_datetime|time:"H:i"}} wrote:
- {{ comment.data }}
+ {{ comment.data|linebreaksbr }}
{% endfor %}
{% endif %}
{% if not is_guest %}