1.展示用户列表
urls.py: path('userinfo_list/',views.userinfo_list)
views.py:
html页面:
结果:
2.添加用户:
urls.py:path('user_add/',views.user_add)
view.py:
html:
结果:
3.删除
urls.py:path('delete/',views.delete)
view.py
def delete(req): nid = req.GET.get("nid") UserInfo.objects.filter(id=nid).delete() return redirect("http://localhost:8000/userinfo_list")
userinfo_list.html
结果:点击删除