Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
What's New in Django 1.3
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Andrew Godwin
May 25, 2011
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
What's New in Django 1.3
A talk I gave at DJUGL in May of 2011
Andrew Godwin
May 25, 2011
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
400
Django Through The Years
andrewgodwin
0
330
Writing Maintainable Software At Scale
andrewgodwin
0
530
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
430
Async, Python, and the Future
andrewgodwin
2
750
How To Break Django: With Async
andrewgodwin
1
830
Taking Django's ORM Async
andrewgodwin
0
850
The Long Road To Asynchrony
andrewgodwin
0
770
The Scientist & The Engineer
andrewgodwin
1
860
Other Decks in Programming
See All in Programming
Android CLI
fornewid
0
190
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
140
地域 SRE コミュニティ最前線 - ホンマでっかSRE勉強会
tk3fftk
0
290
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
130
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
17k
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
160
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
280
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.5k
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
0
580
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
210
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
280
Featured
See All Featured
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
310
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
250
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.7k
Site-Speed That Sticks
csswizardry
13
1.4k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
620
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Navigating Team Friction
lara
192
16k
How GitHub (no longer) Works
holman
316
150k
Optimizing for Happiness
mojombo
378
71k
Transcript
Andrew Godwin http://www.flickr.com/photos/caroslines/1371200717/ What's new in Django 1.3?
Hi, I'm Andrew. Serial Python developer Django core committer Co-founder
of ep.io (Python hosting platform)
Django: A Very Brief History Initial release in 2005 1.0
released in 2008 1.3 released March 2011
1.3 was the "bugfix release" The plan: No major features,
quick release
1.3 was the "bugfix release" The plan: No major features,
quick release The result: 2 major features, 10 months
1.3 was the "bugfix release" The plan: No major features,
quick release The result: 2 major features, 10 months We'll get the next one out quicker...
New Features Class-based views Logging contrib.staticfiles unitttest2 on_delete TemplateResponse
Notable Changes CSRF on AJAX requests Less swearwords Translation/i18n improvements
No more mod_python No more XMLField render() shortcut
Class-Based Views Biggest change in 1.3 Not required for all
new views Designed to simplify common patterns
CBV: Before def object_detail( request, year, month, day, queryset, date_field,
month_format='%b', day_format='%d', object_id=None, slug=None, slug_field='slug', template_name=None, template_name_field=None, template_loader=loader, extra_context=None, context_processors=None, template_object_name='object', mimetype=None, allow_future=False ):
CBV: After class AccountDetail(DetailView): model = Account context_object_name = "account"
slug_field = "snail" def get_context_data(self, **kwargs): context = super(AccountDetail, self)\ .get_context_data(**kwargs) context['books'] = Book.objects.all() return context
CBV: Simple views too! class AccountDetail(TemplateView): template_name = "mytempl.html" def
get_context_data(self, **kwargs): return { "books": Book.objects.all(), "is_evil": True, }
Other uses Refactor common parts into superclasses Mixins for adding-on
functionality Mutate the input or output
Logging Now actually sensible, not just emails Uses standard Python
logging library Configured using the LOGGING setting
LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'handlers': { 'console':{
'level': 'DEBUG', 'class': 'logging.StreamHandler', }, 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', }, 'myproject.custom': { 'handlers': ['console', 'mail_admins'], 'level': 'INFO', } } }
staticfiles Lets apps ship with their static files View to
serve them in development ./manage.py collectstatic for production
unittest2 Better than unittest (obviously) Many new assertion methods Test
skipping Expected failures Much more...
unittest2 Bundled with Django Just change: import unittest from django.utils
import unittest to
on_delete Deleting rows just got better! Cascade delete (as before)
Set to NULL Raise ProtectedError Set to arbitary value
TemplateResponse A HTTPResponse class you can change Template only run
at end of middleware Change context, or even template
TemplateResponse Example from django.template.response \ import TemplateResponse def blog_index(request): return
TemplateResponse( request, 'entry_list.html', {'entries': Entry.objects.all()}, ) ... response.context_data['foo'] = 'bar'
CSRF on AJAX requests CSRF is a hard, hard problem
Flash plus 307 redirect = fail You'll have to start supplying CSRF tokens to your JavaScript
Less Swearwords Guaranteed, or your money back. Also gone: "asshat",
"asshead".
Translation / i18n Marking for ambiguous meanings Overrideable translations for
apps Deprecation of project-wide translations
No more mod_python It's dead, Jim. If you're still using
it, move to mod_wsgi or gunicorn now, please.
No more XMLField We're not really sure why it was
there in the first place.
render() shortcut Like render_to_response, but : Less characters to type
Uses RequestContext Handy for those not on CBV
How do you upgrade? Should be mostly seamless. You'll get
warnings for deprecated settings (e.g. DATABASE_NAME)
What's going to be in 1.4? We're not quite sure
yet. Possible: App refactor HTML5 doctype ORM changes
Future features GSOC should give us: Template engine refactor New
form rendering Schema alteration low-level API Composite fields
Thank you. Andrew Godwin @andrewgodwin
[email protected]