django 简单显示数据库的内容,django数据库内容,index.html<h
django 简单显示数据库的内容,django数据库内容,index.htmlindex.html
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload Successfully</title>
</head>
<body>
<p>所在城市</p>
{% for name in names %}
<p>{{name.city}}</p>
<h2>1</h2>
<p>{{name.name}}</p>
<br>
{% endfor %}
</body>
</html>
from django.http import HttpResponseimport os,syssys.path.insert(0,os.path.abspath(os.curdir))import sqlite3import settingsfrom ms.models import Studentfrom django.shortcuts import HttpResponseRedirect,Http404,HttpResponse,render_to_responsedef archive(request): names = Student.objects.all() return render_to_response("index.html",locals())#该片段来自于http://byrx.net
index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload Successfully</title>
</head>
<body>
<p>所在城市</p>
{% for name in names %}
<p>{{name.city}}</p>
<h2>1</h2>
<p>{{name.name}}</p>
<br>
{% endfor %}
</body>
</html>
from django.http import HttpResponseimport os,syssys.path.insert(0,os.path.abspath(os.curdir))import sqlite3import settingsfrom ms.models import Studentfrom django.shortcuts import HttpResponseRedirect,Http404,HttpResponse,render_to_responsedef archive(request): names = Student.objects.all() return render_to_response("index.html",locals())#该片段来自于http://byrx.net
相关内容
- python的循环语句while用法范例,pythonwhile,#!/usr/bin/p
- python将字符串转换为datetime类型,pythondatetime,python将字
- python 字符串模板功能,python字符串模板,# method 1te
- 处理各种编码的字符串,处理编码字符串,# file: Unic
- python dict初始化方式,pythondict初始化,python字典dict
- ghost_export 是为Ghost 导出博客文件的一个python小工具,
- 让python json encode datetime类型,jsondatetime,python2.6+ 自
- Python 合并文本文件,,# coding gbk
- python ip和long类型之间的相互转换,pythonlong,python ip地址
- python基数排序算法,python基数排序,from random
评论关闭