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
Django 1.7 And You
Search
Andrew Godwin
April 30, 2014
Programming
4
540
Django 1.7 And You
A talk I gave at the San Francisco Django Meetup group
Andrew Godwin
April 30, 2014
Tweet
Share
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
320
Django Through The Years
andrewgodwin
0
210
Writing Maintainable Software At Scale
andrewgodwin
0
440
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
360
Async, Python, and the Future
andrewgodwin
2
670
How To Break Django: With Async
andrewgodwin
1
730
Taking Django's ORM Async
andrewgodwin
0
730
The Long Road To Asynchrony
andrewgodwin
0
660
The Scientist & The Engineer
andrewgodwin
1
770
Other Decks in Programming
See All in Programming
ワープロって実は計算機で
pepepper
2
1.1k
Infer入門
riru
4
1k
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
670
「次に何を学べばいいか分からない」あなたへ──若手エンジニアのための学習地図
panda_program
3
720
SwiftでMCPサーバーを作ろう!
giginet
PRO
2
230
リッチエディターを安全に開発・運用するために
unachang113
1
360
バイブスあるコーディングで ~PHP~ 便利ツールをつくるプラクティス
uzulla
1
320
あのころの iPod を どうにか再生させたい
orumin
2
1.6k
Dart 参戦!!静的型付き言語界の隠れた実力者
kno3a87
0
170
新しいモバイルアプリ勉強会(仮)について
uetyo
1
250
書き捨てではなく継続開発可能なコードをAIコーディングエージェントで書くために意識していること
shuyakinjo
0
220
React 使いじゃなくても知っておきたい教養としての React
oukayuka
18
5.4k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
5.7k
How GitHub (no longer) Works
holman
314
140k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Site-Speed That Sticks
csswizardry
10
760
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.5k
Writing Fast Ruby
sferik
628
62k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.5k
The Invisible Side of Design
smashingmag
301
51k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Transcript
1.7 Andrew Godwin @andrewgodwin & you
Andrew Godwin Author of South migrations library Hi, I'm Author
of 1.7 Django migrations Generally far too involved in Django
Django 1.7 Migrations Scheduled release: May 15th (we'll probably miss
it) App loading refactor Checks framework select_related filters Custom lookups
Migrations They're pretty good.
The (second) Plan Django Schema backend ORM Hooks South 2
Migration handling User interface Backport for 1.4 - 1.6
Logically Separate Schema backend ORM Hooks Migration handling User interface
SchemaEditor Migrations
A New Format More concise Declarative Introspectable
Migration actions Frozen ORM
None
In-memory running Creates models from migration sets Autodetector diffs created
from on-disk Used to feed SchemaEditor / ORM
Backwards Compatability Auto-applies first migration if tables exist Ignores South-style
migrations South will start looking for south_migrations
App Loading Mostly internal change App objects per-app Start of
long path away from settings
Checks Framework Proper support for project-level validation Old validation moved
in Upgrade warnings now possible
from django.core.checks import register @register() def example_check(app_configs, **kwargs): errors =
[] # ... your check logic here return errors
prefetch_related control Now accepts a Prefetch object Can customise order,
select_related, or filter
Pizza.objects.prefetch_related( Prefetch( 'restaurants', queryset=Restaurant.objects.select_related('best_pizza'), ) )
Custom Lookups Allows for more powerful Field subclasses You can
stop using .extra() and .raw() as much
from django.db.models import Lookup class NotEqual(Lookup): lookup_name = 'ne' def
as_sql(self, qn, connection): lhs, lhs_params = self.process_lhs(qn, connection) rhs, rhs_params = self.process_rhs(qn, connection) params = lhs_params + rhs_params return '%s <> %s' % (lhs, rhs), params
Important Upgrade Notes
Fields need deconstruct() It's a required new method for all
fields.
syncdb is deprecated Use migrate (old apps will still work)
initial_data is dead Use data migrations and the ORM instead
Django 1.8? LTS Migrations for contrib apps PostgreSQL improvements?
Thanks. @andrewgodwin aeracode.org