Trim whitespace, max-length check
This commit is contained in:
parent
7016dcab91
commit
8664b7156f
|
@ -25,9 +25,12 @@ def post(request):
|
|||
return render(request, "whispermaphone/login.html", status=401)
|
||||
|
||||
if request.method == "POST":
|
||||
if len(request.POST["text"]) == 0:
|
||||
if len(request.POST["text"].strip()) == 0:
|
||||
return HttpResponse("Need some text.", status=400)
|
||||
|
||||
if len(request.POST["text"]) > 140:
|
||||
return HttpResponse("Content too long", status=400)
|
||||
|
||||
Thought(
|
||||
text=request.POST["text"],
|
||||
extended_text=request.POST["extended_text"],
|
||||
|
|
Loading…
Reference in New Issue