Django1.8文档阅读手记
来源:互联网 发布:ejd网络黄金 编辑:程序博客网 时间:2024/05/17 02:13
主要集中在新特性上。
Django1.8好像开始推荐使用python3
Django的QuerySet是延迟加载的,这个文档里面一般会明言,通过Connection SQL显示测试,外键对象也是延迟加载的。
Django1.8的get filter等方法继续在aptana pydev下error:undefined variables from import,不过收费的pycharm似乎解决自django1.7以后出现的这个问题。
Web development is often broad, not deep – problems span many domains.
One-to-one relationships:This is most useful on the primary key of an object when that object “extends” another object in some way.It is Model inheritance too.
A field name cannot contain more than one underscore in a row, due to the way Django’s query lookup syntax works
limiting the queryset using an array slice or an index will not populate the cache.
If you need to execute more complex queries (for example, queries with OR statements), you can use Q objects.
Note that delete() is the only QuerySet method that is not exposed on a Manager itself. This is a safety mechanism to prevent you from accidentally requesting Entry.objects.delete(), and deleting all the entries.
Forward access to one-to-many relationships is cached the first time the related object is accessed.
对Model层的重新认识,以前一直认为Django的Model层不过是一个Active Record模式的Data Access Layer层,最近重新通篇阅读Guide文档,发现认识有所不足:它不仅是一个自下而上设计实现的数据访问设施,而且是一个面向领域业务模型自上而下设计的模型实现层.
However, when a values() clause is used to constrain the columns that are returned in the result set, the method for evaluating annotations is slightly different. Instead of returning an annotated result for each result in the original QuerySet, the original results are grouped according to the unique combinations of the fields specified in the values() clause.
Class inheritance and model managers aren’t quite a perfect match for each other.
Avoid catching exceptions inside atomic!
As well as caching of the whole QuerySet, there is caching of the result of attributes on ORM objects. In general, attributes that are not callable will be cached,But in general, callable attributes cause DB lookups every time.
- Django1.8文档阅读手记
- django1.5 官方文档阅读笔记(一)
- django1.5 官方文档阅读笔记(二)
- django1.5 官方文档阅读笔记(三)
- django1.5 官方文档阅读笔记(四)
- Django1.4文档中文版
- django1.4 文档
- django1.10 翻译文档
- srilm 阅读文档8
- django1.10官方文档翻译
- django1.10官方文档翻译
- Vim Tutor 阅读手记
- 胡伯涛论文阅读手记
- pyqt4文档阅读(8):QComboBox
- 基于 Django1.10 文档的深入学习(8)—— Model field reference 之 choices
- Django1.10文档学习笔记一
- Django1.10文档学习笔记二
- Django1.10文档学习笔记三
- IOS 圆形头像 UIButton边框 按钮边框
- C++类2
- tomcat6.0发布不了myeclipse的项目
- 连续按2次返回键退出应用 隐藏软键盘
- Reverse Bits
- Django1.8文档阅读手记
- C++/STL Bitset (转)
- 一个简单的将GUI程序的log信息输出到关联的Console窗口中
- RFC3261 SIP协议----register
- 国产前端插件之xgcalendar
- new 内存分配失败处理
- 内部插入排序---直接插入排序
- sparkstreaming保存的kafka数据offset
- iOS多线程——NSRunLoop(2)