摘要: 在Django中,需要把Css和图片等文件放在static files下。然后依次创建下列文件下:polls/static/polls/style.css然后修改style.css如下:li a { color: green;}下一步,在polls/index.html里添加下面代码:{% l... 阅读全文
posted @ 2015-04-20 20:30 坐观云起时 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 1. get是从服务器上获取数据,post是向服务器传送数据。2. get是把参数数据队列加到提交表单的ACTION属性所指的URL中,值和表单内各个字段一一对应,在URL中可以看到。post是通过HTTP post机制,将表单内各个字段与其内容放置在HTML HEADER内一起传送到ACTION属... 阅读全文
posted @ 2015-04-20 18:36 坐观云起时 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 标签用于为用户输入创建 HTML 表单。表单能够包含input 元素,比如文本字段、复选框、单选框、提交按钮等等。表单还可以包含menus、textarea、fieldset、legend和label 元素。表单用于向服务器传输数据。单选按钮的用法:男性:女性:当用户点击一个单选按钮时,该按钮会变... 阅读全文
posted @ 2015-04-20 18:29 坐观云起时 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 首先,在polls/detail.html里添加:{{ poll.question }}{% if error_message %} {{ error_message }}{% endif %}{% csrf_token %}{% for choice in poll.choice_set.a... 阅读全文
posted @ 2015-04-20 18:11 坐观云起时 阅读(341) 评论(0) 推荐(0) 编辑
摘要: Following relationships “backward”If a model has aForeignKey, instances of the foreign-key model will have access to aManager that returns all instanc... 阅读全文
posted @ 2015-04-20 15:31 坐观云起时 阅读(113) 评论(0) 推荐(0) 编辑