From 0863c412932b6ed5247fdcaedf3f0ae2a91d336e Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 31 Aug 2009 17:04:00 -0400 Subject: [PATCH] prevent empty ideas (if only it were that easy) --- brainstorm/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/brainstorm/views.py b/brainstorm/views.py index 8e9b6ac..02a3689 100644 --- a/brainstorm/views.py +++ b/brainstorm/views.py @@ -31,9 +31,11 @@ def idea_detail(request, slug, id): def new_idea(request, slug): subsite = get_object_or_404(Subsite, pk=slug) if not subsite.user_can_post(request.user): - return HttpResponseRedirect(subsite.get_absolute_url()) + return redirect(subsite.get_absolute_url()) title = request.POST['title'] description = request.POST['description'] + if not title.strip() or not description.strip(): + return redirect(subsite.get_absolute_url()) user = request.user idea = Idea.objects.create(title=title, description=description, user=user, subsite=subsite)