+ All Categories
Home > Technology > What's New in Django 1.6

What's New in Django 1.6

Date post: 27-Jan-2015
Category:
Upload: sivasubramaniam-arunachalam
View: 108 times
Download: 2 times
Share this document with a friend
Description:
Presentation used in Bangalore Django User Group Meetup. http://www.meetup.com/Bangalore-Django-User-Group/events/149839872/
Popular Tags:
75
What’s New in Django 1.6 Sivasubramaniam Arunachalam Nov 14, 2013 @sivaa_in http://www.meetup.com/Bangalore-Django-User-Group/events/149839872/
Transcript
Page 2: What's New in Django 1.6

Malcolm

Tredinnick

(We miss you)

Page 3: What's New in Django 1.6

Version Released Date Released After

0.9 Nov 16, 2005

0.91 Jan 11, 2006 2 Months

0.95 Jul 29, 2006 6 Months

0.96 Mar 23, 2007 8 Months

1.0 Sep 03, 2008 17 Months

1.1 Jul 29, 2009 11 Months

1.2 May 17, 2010 9 Months

1.3 Mar 23, 2011 10 Months

1.4 Mar 23, 2012 12 Months

1.5 Feb 26, 2013 11 Months

1.6 Nov 06, 2013 8 Months

Page 4: What's New in Django 1.6

Django Version Supported Python

Version (2.x) Supported Python

Version (3.x)

1.0 2.3+

1.1 2.3+

1.2 2.4+

1.3 2.4+

1.4 2.5+

1.5 2.6+ 3.2+*

1.6 2.6+ 3.2+

1.7 2.7+ 3.2+

* Experimental

Page 5: What's New in Django 1.6

Python 3 Officially Supported

(Enjoy it in Production)

Page 6: What's New in Django 1.6
Page 7: What's New in Django 1.6
Page 9: What's New in Django 1.6

New Features

• Simple Layout

• Improved Transactions

• Persistent DB Connections

• Others

Page 10: What's New in Django 1.6

New Features

• Simple Layout

• Improved Transactions

• Persistent DB Connections

• Others

Page 11: What's New in Django 1.6

Much Simpler (Project & App Layouts)

Page 12: What's New in Django 1.6

Application - added admin

- removed sites

Middleware - added clickjacking prevention

Database - SQLite3

New Defaults

Page 14: What's New in Django 1.6

startproject

• manage.py

• settings.py

• wsgi.py

• urls.py

Page 15: What's New in Django 1.6

startproject

• manage.py

• settings.py

• wsgi.py

• urls.py

Page 16: What's New in Django 1.6

Removed Settings

• ADMINS

• MANAGERS

startproject - settings.py

• STATIC_ROOT

• STATICFILES_DIRS

• STATICFILES_FINDERS

• TEMPLATE_DIRS

• TEMPLATE_LOADERS

• MEDIA_ROOT

• MEDIA_URL

• SITE_ID

• LOGGING

Page 17: What's New in Django 1.6

Modified Settings

startproject - settings.py

Page 18: What's New in Django 1.6

DATABASES (default to SQLite3)

startproject - settings.py - Modified

Page 19: What's New in Django 1.6

TIME_ZONE (default to UTC)

startproject - settings.py - Modified

Page 20: What's New in Django 1.6

INSTALLED_APPS (admin enabled & sites removed by default)

startproject - settings.py - Modified

Page 21: What's New in Django 1.6

MIDDLEWARE_CLASSES (clickjacking protection is enabled by default)

startproject - settings.py - Modified

Page 22: What's New in Django 1.6

New Settings

BASE_DIR

startproject - settings.py

Page 23: What's New in Django 1.6

startproject

• manage.py

• settings.py

• wsgi.py

• urls.py

Page 24: What's New in Django 1.6

admin enabled by default

startproject - urls.py

Page 25: What's New in Django 1.6

startapp

• admin.py

• models.py

• views.py

• tests.py

Page 26: What's New in Django 1.6

startapp

• admin.py

• models.py

• views.py

• tests.py

Page 27: What's New in Django 1.6

admin.py is generated by default

startapp - admin.py

Page 28: What's New in Django 1.6

startapp

• admin.py

• models.py

• views.py

• tests.py

Page 29: What's New in Django 1.6

Default Example TestCase is removed

startapp - tests.py

Page 30: What's New in Django 1.6

File

Django 1.5

Django 1.6

Change

Tar ball 8 M 6.6 M -17.5 %

settings.py 5.3 K 2.0 K -63.1 %

urls.py 556 297 -46.5 %

wsgi.py 1.4 K 387 -72.2 %

tests.py 383 60 -84.3 %

Page 31: What's New in Django 1.6

New Features

• Simple Layout

• Improved Transactions

• Persistent DB Connections

• Others

Page 32: What's New in Django 1.6

Improved Transactions (Biggest Change from 0.9x)

Page 33: What's New in Django 1.6

Old APIs were Deprecated

Transactions

Page 34: What's New in Django 1.6

New APIs were Introduced

Transactions

Page 35: What's New in Django 1.6

Transactions – New APIs

• Clean & Simple

• Improved Performance

• Improved Error Handling

• Fine grained rollbacks between savepoints

Improvements

Page 36: What's New in Django 1.6

Transactions – New APIs

• Enabled by default • Every single SQL Statement is committed immediately

• django.db.transaction.set_autocommit()

DB Level Auto Commit

Page 37: What's New in Django 1.6

Transactions – New APIs

atomic() • New Single API to control DB transactions

• Commit on Success

• Rollback on Exceptions

• It can be

• Nested

• Used as a Decorator & Context Manager

Page 38: What's New in Django 1.6

Transactions – New APIs – atomic()

Decorator

Page 39: What's New in Django 1.6

Transactions – New APIs – atomic()

Context Manager

Page 40: What's New in Django 1.6

Transactions

Backward Incompatible

https://docs.djangoproject.com/en/1.6/topics/db/transactions/

#transactions-upgrading-from-1-5

Page 41: What's New in Django 1.6

Transactions

Excellent Presentations by

Aymeric Augustin

https://myks.org/en/talks/

More Details

Page 42: What's New in Django 1.6

New Features

• Simple Layout

• Improved Transactions

• Persistent DB Connections

• Others

Page 43: What's New in Django 1.6

New Connection for every HTTP Request

Till Django 1.5

Persistent DB Connections

Page 44: What's New in Django 1.6

Same Connection will be reused between requests

In Django 1.6

Persistent DB Connections

Page 45: What's New in Django 1.6

• Life Time of a Database Connection

• Different for each Database

• Default = 0 (Off & No reuse)

• For Unlimited, use None

• Comply with DB Idle Connection Settings

CONN_MAX_AGE

Persistent DB Connections

Page 46: What's New in Django 1.6

• Connection is established during the first query

• Connection won’t be closed and reused for subsequent requests

• One Connection for each Worker Thread

• Once it is exceeds the CONN_MAX_AGE, it will be closed • Beginning & end of each request

Processing Behavior

Persistent DB Connections

Page 47: What's New in Django 1.6

New Features

• Simple Layout

• Improved Transactions

• Persistent DB Connections

• Others

Page 48: What's New in Django 1.6

Locates tests anywhere (test*.py)

New Test Runner

Page 49: What's New in Django 1.6

QuerySet.dates() is now Time Zone Aware

(Earlier Only in UTC)

Page 50: What's New in Django 1.6

QuerySet.dates() is now operates only on DateField() and returns datetime.date

Page 51: What's New in Django 1.6

"hour", "minute" or "second“ lookups are supported

QuerySet.datetimes() is operates on DateTimeField()

and returns datetime.datetime

Page 52: What's New in Django 1.6

BinaryField() is introduced

• Stores raw binary data in bytes

• Queryset is not possible

• Don’t use it to store static files

Page 53: What's New in Django 1.6

django-admin.py check • Verifies the setup for Current Version

• Settings

• Application Code

• Warnings will be issued for incompatibles

Page 54: What's New in Django 1.6

Efficient Model.save()

Before

SELECT is used to determine INSERT (or) UPDATE

Now

if instance has Primary Key, it is UPDATE

else, it is INSERT

Page 55: What's New in Django 1.6

Model.objects.earliest()

(latest() with reverse direction)

Page 56: What's New in Django 1.6

Model.objects.first()

• Returns the first object from QuerySet

• If no order specified, Ordered by PK

• None for EmptyQuerySet

Page 57: What's New in Django 1.6

Model.objects.first()

Page 58: What's New in Django 1.6

Model.objects.last()

Page 59: What's New in Django 1.6

Model.objects.filter(timestamp__hour = 23)

Model.objects.filter(timestamp__minute = 59)

Model.objects.filter(timestamp__second = 59)

Page 60: What's New in Django 1.6

ModelAdmin.preserve_filters

Page 61: What's New in Django 1.6

HTML 5 Types for input fields

(Email, URL and Number)

Supported in • IntegerField

• FloatField

• DecimalField

• EmailField

• URLField

Page 62: What's New in Django 1.6

Blank Password is Supported

Page 63: What's New in Django 1.6

• SQLite Save Points is supported

• Open Layer based GeoDjango Forms API

• Pillow is preferred over PIL for ImageField

• Django Admin jQuery is upgraded from 1.4.2 to 1.9.1

• New Deployment Check List (https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/)

Page 64: What's New in Django 1.6

Notable Changes

Page 65: What's New in Django 1.6

• UNUSABLE_PASSWORD is removed (is_password_usable)

• MAXIMUM_PASSWORD_LENGTH is removed in the latest security fix

• Password reset now uses Base64 Encoding (earlier it was base36)

• BooleanField is not default to False (None). Be Explicit

• django.db.models.query.EmptyQuerySet can’t be instantiated

• django-debug-toolbar is breaking

Page 66: What's New in Django 1.6

Dropped Features

Page 67: What's New in Django 1.6

django.contrib.localflavor

django.contrib.databrowse

django.contrib.markup

Page 68: What's New in Django 1.6

Deprecated Features

Page 69: What's New in Django 1.6

• django.middleware.transaction.TransactionMiddleware

• django.db.transaction.autocommit

• django.db.transaction.commit_on_success

• django.db.transaction.commit_manually

• TRANSACTIONS_MANAGED (in settings.py)

Page 70: What's New in Django 1.6

• CACHE_MIDDLEWARE_ANONYMOUS_ONLY

• SEND_BROKEN_LINK_EMAILS (django.middleware.common.BrokenLinkEmailsMiddleware)

Page 71: What's New in Django 1.6

django.contrib.comments

Page 72: What's New in Django 1.6

Django 1.7

Page 73: What's New in Django 1.6

In built migrations

Page 74: What's New in Django 1.6

Thank You! [email protected]

bit.ly/sivasubramaniam bit.ly/sivaa_in

Page 75: What's New in Django 1.6

References https://docs.djangoproject.com/en/dev/releases/1.6/ https://speakerdeck.com/julienphalip/django-1-dot-6-the-best-new-features-and-the-important-changes


Recommended