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
What's New in Django 1.9
Search
Baptiste Mispelon
October 28, 2015
Technology
1
180
What's New in Django 1.9
Baptiste Mispelon
October 28, 2015
Tweet
Share
More Decks by Baptiste Mispelon
See All by Baptiste Mispelon
Jezdezcon - Stickers vs Buttons
bmispelon
0
88
Baptiste's adventures in Djangoland
bmispelon
0
1.4k
London Django Sprint Intro
bmispelon
0
930
Budapest.py January 2015 Intro
bmispelon
0
73
Announcing: Django Under the Hood
bmispelon
1
140
Stdlib Safari - Exotic Animal Edition
bmispelon
2
200
Tales From the Django Circus
bmispelon
0
210
Other Decks in Technology
See All in Technology
フィンテック養成勉強会#56
finengine
0
120
BPaaSにおける人と協働する前提のAIエージェント-AWS登壇資料
kentarofujii
0
120
LLMを搭載したプロダクトの品質保証の模索と学び
qa
0
650
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
2
270
オブザーバビリティが広げる AIOps の世界 / The World of AIOps Expanded by Observability
aoto
PRO
0
300
まだ間に合う! StrandsとBedrock AgentCoreでAIエージェント構築に入門しよう
minorun365
PRO
11
910
「何となくテストする」を卒業するためにプロダクトが動く仕組みを理解しよう
kawabeaver
0
140
RSCの時代にReactとフレームワークの境界を探る
uhyo
9
3k
『FailNet~やらかし共有SNS~』エレベーターピッチ
yokomachi
1
200
クラウドセキュリティを支える技術と運用の最前線 / Cutting-edge Technologies and Operations Supporting Cloud Security
yuj1osm
2
270
ヘブンバーンズレッドのレンダリングパイプライン刷新
gree_tech
PRO
0
550
AIエージェントの活用に重要な「MCP (Model Context Protocol)」とは何か
masayamoriofficial
0
290
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Bash Introduction
62gerente
615
210k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Designing for Performance
lara
610
69k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Typedesign – Prime Four
hannesfritz
42
2.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Designing Experiences People Love
moore
142
24k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Transcript
What’s New in Django 1.9?
Hi!
Baptiste Mispelon
Django 1.9
Python Support
pip install Django==1.9b1
What’s new?
Major New Features
transaction.on_commit
from django.db import transaction with transaction.atomic(): transaction.on_commit(send_email) do_some_database_stuff()
AUTH_PASSWORD_VALIDATORS
from django.contrib.auth.password_validation import ( UserAttributeSimilarityValidator, MinimumLengthValidator, CommonPasswordValidator, NumericPasswordValidator, )
contrib.auth.mixins
from django.contrib.auth.mixins import ( AccessMixin, LoginRequiredMixin, PermissionRequiredMixin, UserPassesTestMixin, )
New Admin Theme
None
None
None
None
New Admin Theme
Can’t Upgrade Yet? pip install django-flat-theme
./manage.py test --parallel
Random Minor Features
contrib.postgres.JSONField
from django.contrib.postgres.fields import JSONField from django.db import models class Dog(models.Model):
name = models.CharField(max_length=200) data = JSONField()
Dog.objects.create(name='Rufus', data={ 'breed': 'labrador', 'owner': {'name': 'Bob'}, })
Dog.objects.filter( data__breed='collie' )
Dog.objects.filter( data__owner__name='Bob' )
db.backends.postgresql
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
} }
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
} }
Which One?
Which One?
CharField.strip
from django import forms class NameForm(forms.Form): name = forms.CharField()
f = NameForm({ ‘name’: ‘ Baptiste ‘, })
f = NameForm({ ‘name’: ‘ Baptiste ‘, })
>>> f.is_valid() True >>> f.cleaned_data[‘name’] ‘Baptiste’
Field.disabled
from django import forms class PersonForm(forms.Form): name = forms.CharField() age
= forms.IntegerField(disabled=True)
f = PersonForm( initial={‘age’: 30}, data={‘name’: ‘Baptiste’, ‘age’: 12}, )
>>> f.is_valid() True >>> f.cleaned_data[‘age’] 30
./manage.py sendtestemail
./manage.py dumpdata --output
python -m django
django-admin.py startproject foo python -m django startproject foo
--no-input
filter(pub_date__month__gt=6)
from django.db import models class Post(models.Model): title = models.CharField(max_length=100) pub_date
= models.DateTimeField()
Post.objects.filter(pub_date__lt=timezone.now()) Post.objects.filter(pub_date__year=2015) Post.objects.filter(pub_date__year__lte=2014)
What’s Next?
What’s Next?
Thanks!