我正在尝试使用以下代码在django/python中处理表单。
home.html:
<form action="{% url 'home:submit' %}" method='post'>
views.py:
def submit(request):
a = request.POST(['initial'])
return render(request, 'home/home.html', {
'error_message': "returned"
})
urls.py:
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^submit/$', views.submit, name='submit')
]
当我尝试在浏览器中运行它时,出现以下错误:NoReverseMatch at /home/ u'home' is not a registered namespace
还有另一个指示表单问题的错误消息。