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
The year ahead (DjangoCon 2012)
Search
adrianholovaty
September 05, 2012
Programming
1
560
The year ahead (DjangoCon 2012)
BDFL keynote from DjangoCon US (Washington, DC), Sept. 5, 2012.
adrianholovaty
September 05, 2012
Tweet
Share
More Decks by adrianholovaty
See All by adrianholovaty
Some random Django tips
adrianholovaty
1
470
Other Decks in Programming
See All in Programming
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
120
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
280
Next.js App Router
quramy
11
1.6k
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
9
4.2k
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
380
PostmanでAPIの動作確認が楽になった話
h455h1
0
180
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
220
見た目から始める生産性向上
ikumatadokoro
10
1.3k
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
350
Let's learn code review
riofujimon
2
570
Code Reviews
bkuhlmann
4
900
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
100
Featured
See All Featured
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
YesSQL, Process and Tooling at Scale
rocio
165
13k
Optimising Largest Contentful Paint
csswizardry
12
2.4k
Clear Off the Table
cherdarchuk
85
310k
Code Reviewing Like a Champion
maltzj
515
39k
GraphQLの誤解/rethinking-graphql
sonatard
55
9.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
Build your cross-platform service in a week with App Engine
jlugia
226
17k
Navigating Team Friction
lara
179
13k
Building an army of robots
kneath
300
41k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
126
32k
Typedesign – Prime Four
hannesfritz
36
2.1k
Transcript
None
None
None
None
None
None
None
None
None
The year ahead Adrian Holovaty DjangoCon 2012
• Alpha: Oct. 1 (feature freeze, branch created) • Beta:
Nov. 1-ish • Release candidate 1: end of November • Release candidate 2: early December • Final: Christmas! Django 1.5 timeline
None
None
Separate localflavor packages django-localflavor-ar django-localflavor-at django-localflavor-au django-localflavor-be django-localflavor-br django-localflavor-ca django-localflavor-ch
django-localflavor-cl django-localflavor-cn ...
• Django 1.5: Deprecation warning • Django 1.6: Separate (bundled)
packages, shim in repo • Django 1.7: HTTP 410 (GONE) Deprecation policy
>>> from django.contrib import comments Traceback (most recent call last):
File "<stdin>", line 1, in <module> ImportError: What, you actually USE this monstrosity?!
>>> from django.contrib import databrowse Traceback (most recent call last):
File "<stdin>", line 1, in <module> ImportError: Sorry, it was a cool concept, but we never got around to finishing it.
>>> from django.conf import settings >>> settings.PROFANITIES_LIST Traceback (most recent
call last): File "<stdin>", line 1, in <module> FrameworkPlea: Oh, God, please just let this setting die already.
>>> from django.conf import settings >>> settings.SEND_BROKEN_LINK_EMAILS = True Traceback
(most recent call last): File "<stdin>", line 1, in <module> StupidSettingsError: C’mon.
>>> from django.conf import settings >>> settings.SEND_BROKEN_LINK_EMAILS = True Traceback
(most recent call last): File "<stdin>", line 1, in <module> StupidSettingsError:
>>> from django.conf import settings >>> settings.AUTH_PROFILE_MODULE Traceback (most recent
call last): File "<stdin>", line 1, in <module> ThatStinks: Code smell detected
class User(models.Model): username = models.CharField(max_length=30, unique=True) first_name = models.CharField(max_length=30, blank=True)
last_name = models.CharField(max_length=30, blank=True) email = models.EmailField(blank=True) password = models.CharField(max_length=128) is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_superuser = models.BooleanField(default=False) last_login = models.DateTimeField(default=timezone.now) date_joined = models.DateTimeField(default=timezone.now) groups = models.ManyToManyField(Group) user_permissions = models.ManyToManyField(Permission)
In myapp/models.py from django.contrib.auth.models import User class UserProfile(models.Model): user =
models.OneToOneField(User) # required # Other fields here favorite_animal = models.CharField(max_length=20) favorite_beatle = models.CharField(max_length=20)
In myapp/models.py from django.contrib.auth.models import User class UserProfile(models.Model): user =
models.OneToOneField(User) # required # Other fields here favorite_animal = models.CharField(max_length=20) favorite_beatle = models.CharField(max_length=20) In settings.py AUTH_PROFILE_MODULE = 'myapp.UserProfile'
In myapp/models.py from django.contrib.auth.models import User class UserProfile(models.Model): user =
models.OneToOneField(User) # required # Other fields here favorite_animal = models.CharField(max_length=20) favorite_beatle = models.CharField(max_length=20) In settings.py AUTH_PROFILE_MODULE = 'myapp.UserProfile' In views.py request.user.get_profile()
In myapp/models.py class User(models.Model): username = models.CharField(max_length=100) password = models.CharField(max_length=128)
favorite_animal = models.CharField(max_length=20) favorite_beatle = models.CharField(max_length=20)
In myapp/models.py class User(models.Model): username = models.CharField(max_length=100) password = models.CharField(max_length=128)
favorite_animal = models.CharField(max_length=20) favorite_beatle = models.CharField(max_length=20) In settings.py USER_MODEL = 'myapp.User'
In myapp/models.py class User(models.Model): username = models.CharField(max_length=100) password = models.CharField(max_length=128)
favorite_animal = models.CharField(max_length=20) favorite_beatle = models.CharField(max_length=20) In settings.py USER_MODEL = 'myapp.User' In views.py request.user
• Backwards compatible: fall back to old auth.User model •
Any User model can work with the admin, using a clearly defined interface Design goals
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is
undefined.
def mypage(request, slug): obj = MyModel.objects.get(slug=slug) return render(request, 'mypage.html', {'obj':
obj})
def mypage(request, slug): obj = MyModel.objects.get(slug=slug) return render(request, 'mypage.html', {'obj':
obj}) Connection info?
def mypage(request, slug): obj = MyModel.objects.get(slug=slug) return render(request, 'mypage.html', {'obj':
obj}) Connection info? Template location?
def mypage(request, slug): obj = request.app.query(MyModel).get(slug=slug) return request.app.render('mypage.html', {'obj': obj})
def mypage(request, slug): obj = request.app.query(MyModel).get(slug=slug) return request.app.render('mypage.html', {'obj': obj})
app.query()
def mypage(request, slug): obj = request.app.query(MyModel).get(slug=slug) return request.app.render('mypage.html', {'obj': obj})
app.query() app.render()
def mypage(request, slug): obj = request.app.query(MyModel).get(slug=slug) return request.app.render('mypage.html', {'obj': obj})
from django import YetAnotherAppClass app = YetAnotherAppClass(settings={ 'DATABASES': '...', 'TEMPLATE_DIRS': ['/path/to/templates'], }, rootview=my_urls) app.runserver()
>>> from django import javascript_stuff Traceback (most recent call last):
File "<stdin>", line 1, in <module> NotImplementedYet: But it’s about time.
PJAX (P = pushstate)
Web framework
Web framework returns full page Web framework returns full page
None
Web framework returns full page Web framework returns *diff* and
changes URL
Overview
Overview Click link Trigger Ajax request
Overview Click link Trigger Ajax request Server says: “These bits
changed”
Overview Click link Trigger Ajax request Server says: “These bits
changed” JavaScript changes the page in place
Overview Click link Trigger Ajax request Server says: “These bits
changed” JavaScript changes the page in place URL gets updated with pushstate
MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.pjax.middleware.PjaxMiddleware', )
http://tinyurl.com/pjaxvideo
Real-time
Content sites Applications # of sites
Content sites Applications # of sites
Content sites Applications # of sites Move this to the
right
Thanks for using Django Love, Adrian