prevent empty ideas (if only it were that easy)
This commit is contained in:
parent
07921966b8
commit
0863c41293
@ -31,9 +31,11 @@ def idea_detail(request, slug, id):
|
|||||||
def new_idea(request, slug):
|
def new_idea(request, slug):
|
||||||
subsite = get_object_or_404(Subsite, pk=slug)
|
subsite = get_object_or_404(Subsite, pk=slug)
|
||||||
if not subsite.user_can_post(request.user):
|
if not subsite.user_can_post(request.user):
|
||||||
return HttpResponseRedirect(subsite.get_absolute_url())
|
return redirect(subsite.get_absolute_url())
|
||||||
title = request.POST['title']
|
title = request.POST['title']
|
||||||
description = request.POST['description']
|
description = request.POST['description']
|
||||||
|
if not title.strip() or not description.strip():
|
||||||
|
return redirect(subsite.get_absolute_url())
|
||||||
user = request.user
|
user = request.user
|
||||||
idea = Idea.objects.create(title=title, description=description, user=user,
|
idea = Idea.objects.create(title=title, description=description, user=user,
|
||||||
subsite=subsite)
|
subsite=subsite)
|
||||||
|
Loading…
Reference in New Issue
Block a user