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
630
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
一休.com のログイン体験を支える技術 〜Web Components x Vue.js 活用事例と最適化について〜
atsumim
0
470
CI改善もDatadogとともに
taumu
0
120
Writing documentation can be fun with plugin system
okuramasafumi
0
120
Linux && Docker 研修/Linux && Docker training
forrep
24
4.5k
Grafana Loki によるサーバログのコスト削減
mot_techtalk
1
130
技術を根付かせる / How to make technology take root
kubode
1
250
Formの複雑さに立ち向かう
bmthd
1
850
Unity Android XR入門
sakutama_11
0
160
仕様変更に耐えるための"今の"DRY原則を考える / Rethinking the "Don't repeat yourself" for resilience to specification changes
mkmk884
0
160
チームリードになって変わったこと
isaka1022
0
200
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
140
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
390
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
133
33k
How to train your dragon (web standard)
notwaldorf
91
5.8k
Documentation Writing (for coders)
carmenintech
67
4.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Producing Creativity
orderedlist
PRO
344
39k
For a Future-Friendly Web
brad_frost
176
9.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
Scaling GitHub
holman
459
140k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
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