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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Baptiste Mispelon
October 28, 2015
Technology
200
1
Share
What's New in Django 1.9
Baptiste Mispelon
October 28, 2015
More Decks by Baptiste Mispelon
See All by Baptiste Mispelon
Jezdezcon - Stickers vs Buttons
bmispelon
0
100
Baptiste's adventures in Djangoland
bmispelon
0
1.6k
London Django Sprint Intro
bmispelon
0
940
Budapest.py January 2015 Intro
bmispelon
0
80
Announcing: Django Under the Hood
bmispelon
1
170
Stdlib Safari - Exotic Animal Edition
bmispelon
2
230
Tales From the Django Circus
bmispelon
0
220
Other Decks in Technology
See All in Technology
みんなで作るAWS Tips 100連発 (FinOps編)
schwrzktz
1
300
最近の技術系の話題で気になったもの色々(IoT系以外も) / IoTLT 花見予定会(たぶんBBQ) @都立潮風公園バーベキュー広場
you
PRO
1
240
AzureのIaC管理からログ調査まで、随所に役立つSkillsとCustom-Instructions / Boosting IaC and Log Analysis with Skills
aeonpeople
0
230
昔はシンプルだった_AmazonS3
kawaji_scratch
0
330
国内外の生成AIセキュリティの最新動向 & AIガードレール製品「chakoshi」のご紹介 / Latest Trends in Generative AI Security (Domestic & International) & Introduction to AI Guardrail Product "chakoshi"
nttcom
2
850
AI時代 に増える データ活用先
takahal
0
230
Standards et agents IA : un tour d’horizon de MCP, A2A, ADK et plus encore
glaforge
0
170
AWS認定資格は本当に意味があるのか?
nrinetcom
PRO
2
270
Practical TypeProf: Lessons from Analyzing Optcarrot
mame
0
340
Pure Intonation on Browser: Building a Sequencer with Ruby
nagachika
0
120
No Types Needed, Just Callable Method Check
dak2
1
1.2k
Shipping AI Agents — Lessons from Production
vvatanabe
0
240
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Automating Front-end Workflow
addyosmani
1370
200k
Faster Mobile Websites
deanohume
310
31k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
310
Code Reviewing Like a Champion
maltzj
528
40k
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
How to train your dragon (web standard)
notwaldorf
97
6.6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
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!