Django Code Reorder Medium +20 XP
Form Processing View
Arrange the form processing logic correctly.
Click lines in the correct order
Available lines4 left
Your order
Click lines above to build your solution.
Show answer and explanation
Answer: if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid(): form.save(); return redirect('/')
return render(request, 'form.html', {'form': form})
Check method, bind data, validate and save, then redirect. Render the form for GET or invalid POST.
Hint: Check method → bind → validate → redirect.
What this challenge tests
Code Reorder in Django: forms, views.