Fakultas Ilmu Komputer UI

Commit 13104858 authored by Rani Lasma Uli's avatar Rani Lasma Uli
Browse files

add validation to handle empty string

parent 1d28c7cc
Pipeline #23318 passed with stages
in 7 minutes and 24 seconds
......@@ -4,7 +4,7 @@ from lists.models import Item
response = {}
def index(request):
if request.method == 'POST':
if request.method == 'POST' and request.POST['item_text'] != '':
Item.objects.create(text=request.POST['item_text'])
return redirect('/')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment