Django 1.5的重大改進一覽
[i=s] 本帖最後由 jieforest 於 2012-12-3 20:29 編輯
With the announcement of Django 1.5B1 and the final release of 1.5 around the corner I thought I’d go over some of the largest new features. For those that want to see the release notes you can do so here.
Overview
The biggest new feature in Django 1.5 is the configurable User model. Before Django 1.5, applications that wanted to use Django’s auth framework (django.contrib.auth) were forced to use Django’s definition of a “user”. In Django 1.5, you can now swap out the User model for one that you write yourself. This could be a simple extension to the existing User model – for example, you could add a Twitter or Facebook ID field – or you could completely replace the User with one totally customized for your site.
Django 1.5 is also the first release with Python 3 support! We’re labeling this support “experimental” because we don’t yet consider it production-ready, but everything’s in place for you to start porting your apps to Python 3. Our next release, Django 1.6, will support Python 3 without reservations.
Other notable new features in Django 1.5 include:
1. Support for saving a subset of model’s fields - Model.save() now accepts an update_fields argument, letting you specify which fields are written back to the database when you call save(). This can help in high-concurrency operations, and can improve performance.
2. Better support for streaming responses via the new StreamingHttpResponse response class.
3. GeoDjango now supports PostGIS 2.0.
... and more; see below.
Wherever possible we try to introduce new features in a backwards-compatible manner per our API stability policy. However, as with previous releases, Django 1.5 ships with some minor backwards incompatible changes; people upgrading from previous versions of Django should read that list carefully.
One deprecated feature worth noting is the shift to “new-style” url tag. Prior to Django 1.3, syntax like {% url myview %} was interpreted incorrectly (Django considered "myview" to be a literal name of a view, not a template variable named myview). Django 1.3 and above introduced the {% load url from future %} syntax to bring in the corrected behavior. where myview was seen as a variable.
The upshot of this is that if you are not using {% load url from future %} in your templates, you’ll need to change tags like {% url myview %} to {% url "myview" %}. If you were using {% load url from future %} you can simply remove that line under Django 1.5
With the announcement of Django 1.5B1 and the final release of 1.5 around the corner I thought I’d go over some of the largest new features. For those that want to see the release notes you can do so here.
Overview
The biggest new feature in Django 1.5 is the configurable User model. Before Django 1.5, applications that wanted to use Django’s auth framework (django.contrib.auth) were forced to use Django’s definition of a “user”. In Django 1.5, you can now swap out the User model for one that you write yourself. This could be a simple extension to the existing User model – for example, you could add a Twitter or Facebook ID field – or you could completely replace the User with one totally customized for your site.
Django 1.5 is also the first release with Python 3 support! We’re labeling this support “experimental” because we don’t yet consider it production-ready, but everything’s in place for you to start porting your apps to Python 3. Our next release, Django 1.6, will support Python 3 without reservations.
Other notable new features in Django 1.5 include:
1. Support for saving a subset of model’s fields - Model.save() now accepts an update_fields argument, letting you specify which fields are written back to the database when you call save(). This can help in high-concurrency operations, and can improve performance.
2. Better support for streaming responses via the new StreamingHttpResponse response class.
3. GeoDjango now supports PostGIS 2.0.
... and more; see below.
Wherever possible we try to introduce new features in a backwards-compatible manner per our API stability policy. However, as with previous releases, Django 1.5 ships with some minor backwards incompatible changes; people upgrading from previous versions of Django should read that list carefully.
One deprecated feature worth noting is the shift to “new-style” url tag. Prior to Django 1.3, syntax like {% url myview %} was interpreted incorrectly (Django considered "myview" to be a literal name of a view, not a template variable named myview). Django 1.3 and above introduced the {% load url from future %} syntax to bring in the corrected behavior. where myview was seen as a variable.
The upshot of this is that if you are not using {% load url from future %} in your templates, you’ll need to change tags like {% url myview %} to {% url "myview" %}. If you were using {% load url from future %} you can simply remove that line under Django 1.5
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-750471/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Django進階之路(一)Django
- Django 的自我進化Django
- 1.5進位制轉換
- 蘋果全新MacBook重大改進:OLED觸控按鍵蘋果Mac
- oracle 10g裡,Merge語句的重大改進 ztOracle 10g
- 來自 Fedora 24 工作站版的四大改進
- Redis進階知識一覽Redis
- 破解“選號王一號 v1.5 預覽版” (3千字)
- 【VMware vSphere】VMware vSphere 9 將有 vLCM 重大改進?
- 走進安卓的重災區——video(微信X5瀏覽器)安卓IDE瀏覽器
- python框架Django 1.5 正式版釋出,Python 3 支援Python框架Django
- Django 進階之 celeryDjango
- 第一篇:開始進入 django 之旅Django
- samples-1.5_03問題望除錯成功的進除錯
- Django教程(二)- Django檢視與網址進階Django
- 瀏覽器的重繪與重排瀏覽器
- Repractise架構篇一: CMS的重構與演進架構
- Repractise架構篇一:CMS的重構與演進架構
- Final Cut Pro X已更新,工作流程有了重大改進
- django限制使用者重複登陸Django
- 在Django中查詢重複專案Django
- 1.5 使用nvicat和kettle進行全量遷移
- Django初探一Django
- 微軟即將推出Win10版本1909,效能續航大改進微軟Win10
- 八大改進:Linux桌面Ubuntu最新版釋出(轉)LinuxUbuntu
- 學點簡單的Django之第一個Django程式Django
- 1.5
- P8119 「Wdoi-1.5」幻想鄉遊覽計劃
- Python Django進階教程(一)(高階檢視和URL配置)PythonDjango
- Final Cut Pro X新版本在工作流程有了重大改進
- 你的第一個Django程式Django
- 重溫一下 JS 進階需要掌握的 13 個概念JS
- Python Django進階教程(五)(session,Django使用者認證)PythonDjangoSession
- Django教程(一) Django檢視與網址Django
- Django2.0(一)Django框架開發流程Django框架
- iOS逆向之旅(進階篇) — 重簽名APP(一)iOSAPP
- 初識Django(一)Django
- django基礎(一)Django