标签:dmi 效果 基础 ges value alt logs input 技术分享
1,urls中name设置使用 表单提交的时候url更改了。模板不用更改 url=Reg
from django.conf.urls import url,include
from django.contrib import admin
from app01 import views
urlpatterns = [
url(r‘^admin/‘, admin.site.urls),
# url(r‘app01/‘,include(‘app01.urls‘)),
url(r‘reg‘,views.reg,name=‘Reg‘)
]
<form action="{% url ‘Reg‘ %}">
<input type="text" name="user">
<input type="submit" value="提交">
</form>
补充:自定义include urls设置情况下name设置
from django.conf.urls import url,include
from django.contrib import admin
from app01 import views
urlpatterns = [
url(r‘^admin/‘, admin.site.urls),
url(r‘app01/‘,include(‘app01.urls‘)),
# url(r‘reg‘,views.reg,name=‘Reg‘)
]
from django.conf.urls import url,include
from app01 import views
urlpatterns = [
url(r‘^reg/‘,views.reg,name="Reg")
]
<form action="{% url ‘Reg‘ %}">
<input type="text" name="user">
<input type="submit" value="提交">
</form>
效果:
标签:dmi 效果 基础 ges value alt logs input 技术分享
原文地址:http://www.cnblogs.com/tiantao36/p/7399635.html