哪种 HttpResponse 方法可以帮助我做到这一点?我在某些视图中有一个表单验证代码:
if request.method == 'POST'
form = SomeForm(request.POST)
if form.is_valid():
form.save()
else:
return HttpResponseRedirect('back.to.this.view')
# I want to redirect to the same form page with a small error message
#below the form saying "This is an empty form"
如何在页面中添加该消息?
我是 Django 和 Web 开发的新手