Fork me on GitHub
上一页 1 ··· 107 108 109 110 111 112 113 114 115 ··· 119 下一页
摘要: 1.导入相应的包 2.HttpResponse(返回字符串给浏览器) 3.render(可以将后台的数据传给前端,三个参数:request,url,context) 3.redirect(跳转到指定的url) 主要还是使用render。 阅读全文
posted @ 2019-11-01 14:58 西西嘛呦 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 1.NoReverseMatch at / Reverse for 'about' not found. 'about' is not a valid view function or pattern name. 这是因为自己指定了app_name,app_name='person' 在html界面 阅读全文
posted @ 2019-10-31 23:10 西西嘛呦 阅读(358) 评论(1) 推荐(1) 编辑
摘要: 1.建立django项目 django-admin startproject myblog 2.进入myblog目录 建立app存储自己的基本信息 python manage.py startapp person 3.在settings.py中注册app,在INSTALLED_APPS里面加入'ps 阅读全文
posted @ 2019-10-30 21:20 西西嘛呦 阅读(360) 评论(0) 推荐(0) 编辑
摘要: models.py forms.py views.py index.html 点击提交: 阅读全文
posted @ 2019-10-29 22:03 西西嘛呦 阅读(943) 评论(0) 推荐(1) 编辑
摘要: class StudentForms(forms.ModelForm): formats=[ '%Y-%m-%d', '%m/%d/%Y', ] birthday = forms.DateField(label='出生日期', input_formats=formats) class Meta: m 阅读全文
posted @ 2019-10-29 21:04 西西嘛呦 阅读(272) 评论(0) 推荐(0) 编辑
摘要: {{title}} 这是主界面--> {{fo... 阅读全文
posted @ 2019-10-29 20:57 西西嘛呦 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 要注意是模板元素 和 表单元素的对应。 阅读全文
posted @ 2019-10-29 20:48 西西嘛呦 阅读(406) 评论(0) 推荐(0) 编辑
摘要: models.py-->forms.py-->views.py(get)--index.html-->views.py(post)-->home.html urls.py models.py forms.py views.py index.html home.html 阅读全文
posted @ 2019-10-29 20:28 西西嘛呦 阅读(242) 评论(0) 推荐(0) 编辑
摘要: urls.py forms.py views.py index.html home.html index界面: 输入相应信息,点击提交,信息会传到home界面,并显示 阅读全文
posted @ 2019-10-29 19:40 西西嘛呦 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 1.在book app目录下新建一个forms.py,并加入 urls.py配置路径: views.py中配置视图: index.html 具体页面: 我们只测试接受birthday:注意输入的日期格式。 阅读全文
posted @ 2019-10-29 17:08 西西嘛呦 阅读(529) 评论(0) 推荐(0) 编辑
上一页 1 ··· 107 108 109 110 111 112 113 114 115 ··· 119 下一页