标签:rmi view rom val mina login server app rcu
------------恢复内容开始------------
2.创建具体应用(app01文件)
文件下创建views.py视图文件
该文件用来编写函数----功能
2.配置路由系统(urls-->函数)
from app01 import views
urlpatterns = [
# path(‘admin/‘, admin.site.urls),
path(‘login/‘, views.login),
path(‘add_users/‘, views.add_users),
path(‘del_users/‘, views.del_users),
path(‘modify_users/‘, views.modify_users),
path(‘model_add_users/‘, views.model_add_users),
]
path(url路径,函数路径)
3.编写函数
学习使用HttpRespones, render, redirect
2.return render(request,‘index.html‘,{"rlts",[0,1,1,1,2,5,5]})
在html文件中代码的编写方式,
{% for row in rlts %}
手机号:
账户名:
密 码:
3.1可以直接跳转到某一个网址里面---return redirect("http://www.baidu.com")
3.2跳转自己编写的某一个网址---return redirect("/classes/")
3.3
from django.shorcut import HttpRespones,render,redirect
def login(request):
if request.method == "GET":
return render(request,‘login.html‘,{
"items":[1,2,3,4],
"dic_items":{"id":1,"user":123,"pwd":123456},
"list_dict_items":[{"id":1,"user":123,"pwd":123456},
{"id":2,"user":132,"pwd":123456},
{"id":3,"user":321,"pwd":123456}]
})
else:
return redirect("https://www.baidu.com")
------------恢复内容结束------------
标签:rmi view rom val mina login server app rcu
原文地址:https://www.cnblogs.com/hq001/p/13910499.html