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
170
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
77
Baptiste's adventures in Djangoland
bmispelon
0
1.3k
London Django Sprint Intro
bmispelon
0
910
Budapest.py January 2015 Intro
bmispelon
0
60
Announcing: Django Under the Hood
bmispelon
1
110
Stdlib Safari - Exotic Animal Edition
bmispelon
2
180
Tales From the Django Circus
bmispelon
0
190
Other Decks in Technology
See All in Technology
チームビルディングは"感性"で向き合おう / Team Building with Awareness
kohzas
0
270
たった1人からはじめる【Agile Community of Practice】~ソース原理とFearless Changeを添えて~
ktc_corporate_it
1
500
より快適なエラーログ監視を目指して
leveragestech
4
1.5k
実務における脅威モデリングを考えよう
nikinusu
0
700
「家族アルバム みてね」における運用管理・ オブザーバビリティの全貌 / Overview of Operation Management and Observability in FamilyAlbum
isaoshimizu
4
170
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
140
スタッフエンジニアの道: The Staff Engineer’s Path
snoozer05
PRO
44
14k
Swift Testingのconfirmationを コードリーディング/Dive into Swift Testing confirmation
laprasdrum
2
270
JEP 480: Structured Concurrency
aya_ebata
0
130
Oracle Autonomous Database:サービス概要のご紹介
oracle4engineer
PRO
1
7.1k
AIを活用した柔軟かつ効率的な社内リソース検索への取り組み
cygames
0
200
プロダクトエンジニアを支えるための開発生産性向上施策
tsukakei
0
150
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
166
48k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
109
6.9k
Creatively Recalculating Your Daily Design Routine
revolveconf
215
12k
Designing the Hi-DPI Web
ddemaree
278
34k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
24
610
Agile that works and the tools we love
rasmusluckow
327
20k
No one is an island. Learnings from fostering a developers community.
thoeni
18
2.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.6k
A Tale of Four Properties
chriscoyier
155
22k
From Idea to $5000 a Month in 5 Months
shpigford
379
46k
4 Signs Your Business is Dying
shpigford
179
21k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
27
7.4k
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!