
Django
iteye_18573
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[django]newforms两种方式示例
newforms是django新的对表单处理功能,查看官方文档:http://www.djangoproject.com/documentation/newforms/最近也在看newsform的文章,总结了两种使用的方法,如下所示:一、根据model自动生成newsformmodel:<!--<br><br>Code highlighting produced by...2007-02-11 11:32:00 · 186 阅读 · 0 评论 -
[django]the story about Django and TurboGears
I was walking across a bridge one day, and I saw a man standingon the edge, about to jump off. So I ran over and said, “Stop! Don’t doit!”“I can’t help it,” he cried. “I’ve lost my will to live....2007-02-12 13:04:00 · 148 阅读 · 0 评论 -
全局自定义templatetags
1.创建一globaltags的django app.2.将一些自定义的templatetags文件复制到globaltags的目录下,如:PyIf Template Tag (Conditional Tag)ExprTagTemplate tag to dump database query info 3.在globaltags的目录下的__init__.py文件中加入如...原创 2009-07-04 09:32:15 · 201 阅读 · 0 评论 -
Django中的flash message
在做web系统的时候,我们需要针对一些操作的结果要进行提示信息给用户,如“××××保存成功!”,“××××出现错误!”。 在基于mvc的模型的框架下,我们可以采用flash message的方式。 以前在用web2py框架的时候,主要写:response.flash = '订购%s成功'% foods[0].name 就会自动在上方提示response.flash的信息...原创 2009-07-04 09:58:33 · 374 阅读 · 0 评论 -
yaml作为django的fixtures
在做django项目的单元测试的时候,我们经常需要为测试准备一些测试数据,所以django中提供了fixtures.以前采用json作为fixtures的文件格式,今天突然看到fixtures支持xml/yaml/json,所以尝试使用yaml,省去了json格式里面一大推"{的符号,看上去更清洁.1.安装PyYAML http://www.pyyaml.org/wiki/PyYAM...2009-08-12 17:10:05 · 569 阅读 · 1 评论 -
修改Nashvegas支持postgres数据库
Nashvegas: A Simple Django Migration Tool 介绍:http://paltman.com/2009/feb/24/nashvegas-a-simple-django-migration-tool/ 就是采用创建sql文件的方式进行数据库的迁移. Git库地址:http://github.com/paltman/nashvegas...原创 2009-08-12 17:16:52 · 172 阅读 · 0 评论 -
自定义form field和widget(YearMonthField)
django的form将界面的展示和数据校验转换做了很好的封装,并且提供了很多的一些Field和Widget,昨天在做一个项目时有一个月报表的功能,查询的时候需要选择某年某月,于是参照一些网站信息,写了一个YearMonthField.#创建年月表单控件 class YearMonthWidget(forms.MultiWidget): """ A widg...2009-08-14 11:01:04 · 246 阅读 · 0 评论 -
Error: App with label *** could not be found. Are you sure your INSTALLED_AP
今天在项目中使用manage.py sqlall commend.却出现了如题的错误. 后来检查发现到.commend的Application和另一个Application users的models中有相互依赖,导致出现循环引用的关系. commend.models-> users.models.Departmentusers.models -> commend....原创 2009-08-15 08:00:27 · 146 阅读 · 0 评论 -
Django多表查询
tables = """commend_intonetworkdata d,commend_intonetwork n"""wheresql = """commend_intonetworkdata.ismatched=false andcommend_intonetwork.status!='success' andtrim(commend_intonetwork...原创 2009-08-25 13:52:04 · 271 阅读 · 0 评论