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
Zoneless Testing
rainerhahnekamp
0
120
CSC509 Lecture 14
javiergs
PRO
0
140
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
770
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
快速入門可觀測性
blueswen
0
340
Beyond ORM
77web
3
430
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
1
510
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
testcontainers のススメ
sgash708
1
120
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
720
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Code Review Best Practice
trishagee
65
17k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
GitHub's CSS Performance
jonrohan
1030
460k
Making Projects Easy
brettharned
116
5.9k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Site-Speed That Sticks
csswizardry
2
190
The Cult of Friendly URLs
andyhume
78
6.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Building Your Own Lightsaber
phodgson
103
6.1k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
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