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
620
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
480
Other Decks in Programming
See All in Programming
命名をリントする
chiroruxx
1
390
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
690
Jakarta EE meets AI
ivargrimstad
0
230
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
170
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
CSC305 Lecture 25
javiergs
PRO
0
130
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1k
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
Featured
See All Featured
Building Applications with DynamoDB
mza
91
6.1k
The Cost Of JavaScript in 2023
addyosmani
45
7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Making Projects Easy
brettharned
116
5.9k
How to Ace a Technical Interview
jacobian
276
23k
Scaling GitHub
holman
458
140k
Producing Creativity
orderedlist
PRO
341
39k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
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