form 里 action 跳转不了
<form aciton="{% url 'dairy:edit_action' %}" method="post" > {% csrf_token %} {% if article %} <input type="hidden" name="article_id" value="{{ article.id }}"/> <label>文章标题 <input type="text" name="title" value="{{ article.title }}"/> </label> <br/><br/> <label>文章内容 <input type="text" name="content" value="{{ article.content }}"/> </label> {% else %} <input type="hidden" name="article_id" value="0"> <label>文章标题 <input type="text" name="title" /> </label> <br/><br/> <label>文章内容 <input type="text" name="content" /> </label> {% endif %} <br/><br/> <input type="submit" value="点击提交"> </form>
点击 点击提交后 跳转不到 edit/action 页面 什么原因 urls.py也添加url了
urlpatterns = [ url(r'^ymm/$', views.index), url(r'^article/(?P<article_id>[0-9]+)$', views.article_page, name='article_page'), url(r'^edit/(?P<article_id>[0-9]+)$', views.edit_page, name='edit_page'), url(r'^edit/action$', views.edit_action, name='edit_action'), ]