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
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
960
Budapest.py January 2015 Intro
bmispelon
0
80
Announcing: Django Under the Hood
bmispelon
1
180
Stdlib Safari - Exotic Animal Edition
bmispelon
2
230
Tales From the Django Circus
bmispelon
0
220
Other Decks in Technology
See All in Technology
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.8k
Unlocking the Apps
pimterry
0
150
開発を止めない CI/CD ~CI Visibilityによる継続的最適化~
pensuke628
0
230
イベントストーミングとKiroの仕様駆動開発で実現する要件の認識合わせプロセス
syobochim
7
1k
Ruby::Boxでできること、Refinementsでできること
joker1007
3
310
Platform engineering for developers, architects & the rest of us (AI agents)
danielbryantuk
0
160
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
400
Datadog 認定試験の概要と対策
uechishingo
0
220
Claude code Orchestra
ozakiomumkj
3
830
Claude Codeですべての日常業務を爆速化しよう!
minorun365
PRO
17
16k
さきさん文庫の書籍ができるまで
sakiengineer
0
330
A Harness for Behaviour: how to get AI to generate code that does what we intend, or "TDD in the age of AI"
xpmatteo
1
540
Featured
See All Featured
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
600
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
WCS-LA-2024
lcolladotor
0
610
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
320
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
150
The Cult of Friendly URLs
andyhume
79
6.9k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
340
How to Ace a Technical Interview
jacobian
281
24k
Faster Mobile Websites
deanohume
310
31k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
810
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!