What's New in Django 1.6
Upcoming SlideShare
Loading in...5
×
 

What's New in Django 1.6

on

  • 7,585 views

Presentation used in Bangalore Django User Group Meetup.

Presentation used in Bangalore Django User Group Meetup.
http://www.meetup.com/Bangalore-Django-User-Group/events/149839872/

Statistics

Views

Total Views
7,585
Views on SlideShare
7,171
Embed Views
414

Actions

Likes
13
Downloads
65
Comments
0

6 Embeds 414

http://in.pycon.org 318
https://twitter.com 54
http://discuss.vccloud.vn 21
http://www.linkedin.com 14
https://honey.is 5
http://localhost 2

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    What's New in Django 1.6 What's New in Django 1.6 Presentation Transcript

    • What’s New in Django 1.6 Nov 14, 2013 Sivasubramaniam Arunachalam @sivaa_in http://www.meetup.com/Bangalore-Django-User-Group/events/149839872/
    • Malcolm Tredinnick (We miss you)
    • 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
    • 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
    • Python 3 Officially Supported (Enjoy it in Production)
    • LTS Releases Django 1.4 till March 2015 https://docs.djangoproject.com/en/dev/internals/release-process/#long-term-support-lts-releases
    • New Features • • • • Simple Layout Improved Transactions Persistent DB Connections Others
    • New Features • • • • Simple Layout Improved Transactions Persistent DB Connections Others
    • Much&Simpler (Project App Layouts)
    • New Defaults Application - added admin - removed sites Middleware - added clickjacking prevention Database - SQLite3
    • Custom Templates (For Projects & Applications) https://docs.djangoproject.com/en/1.6/ref/django-admin/#custom-app-and-project-templates
    • startproject • • • • manage.py settings.py wsgi.py urls.py
    • startproject • • • • manage.py settings.py wsgi.py urls.py
    • Removed Settings • • • • • TEMPLATE_DIRS TEMPLATE_LOADERS STATIC_ROOT STATICFILES_DIRS STATICFILES_FINDERS • • SITE_ID LOGGING • • ADMINS MANAGERS • • MEDIA_ROOT MEDIA_URL startproject - settings.py
    • Modified Settings startproject - settings.py
    • DATABASES (default to SQLite3) startproject - settings.py - Modified
    • TIME_ZONE (default to UTC) startproject - settings.py - Modified
    • INSTALLED_APPS (admin enabled & sites removed by default) startproject - settings.py - Modified
    • MIDDLEWARE_CLASSES (clickjacking protection is enabled by default) startproject - settings.py - Modified
    • New Settings BASE_DIR startproject - settings.py
    • startproject • • • • manage.py settings.py wsgi.py urls.py
    • admin enabled by default startproject - urls.py
    • startapp • • • • admin.py models.py views.py tests.py
    • startapp • • • • admin.py models.py views.py tests.py
    • admin.py is generated by default startapp - admin.py
    • startapp • • • • admin.py models.py views.py tests.py
    • Default Example TestCase is removed startapp - tests.py
    • File Django 1.5 Django 1.6 Change Tar ball 8M 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 %
    • New Features • • • • Simple Layout Improved Transactions Persistent DB Connections Others
    • Improved Transactions (Biggest Change from 0.9x)
    • Old APIs were Deprecated Transactions
    • New APIs were Introduced Transactions
    • Improvements • • • • Clean & Simple Improved Performance Improved Error Handling Fine grained rollbacks between savepoints Transactions – New APIs
    • DB Level Auto Commit • Enabled by default • Every single SQL Statement is committed immediately • django.db.transaction.set_autocommit() 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 Transactions – New APIs
    • Decorator Transactions – New APIs – atomic()
    • Context Manager Transactions – New APIs – atomic()
    • Backward Incompatible https://docs.djangoproject.com/en/1.6/topics/db/transactions/ #transactions-upgrading-from-1-5 Transactions
    • More Details Excellent Presentations by Aymeric Augustin https://myks.org/en/talks/ Transactions
    • New Features • • • • Simple Layout Improved Transactions Persistent DB Connections Others
    • Till Django 1.5 New Connection for every HTTP Request Persistent DB Connections
    • In Django 1.6 Same Connection will be reused between requests Persistent DB Connections
    • CONN_MAX_AGE • • • • • 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 Persistent DB Connections
    • Processing Behavior • • 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 Persistent DB Connections
    • New Features • • • • Simple Layout Improved Transactions Persistent DB Connections Others
    • New Test Runner Locates tests anywhere (test*.py)
    • QuerySet.dates() is now Time Zone Aware (Earlier Only in UTC)
    • QuerySet.dates() is now operates only on DateField() and returns datetime.date
    • QuerySet.datetimes() is operates on DateTimeField() and returns datetime.datetime "hour", "minute" or "second“ lookups are supported
    • BinaryField() is introduced • Stores raw binary data in bytes • Queryset is not possible • Don’t use it to store static files
    • django-admin.py check • Verifies the setup for Current Version • Settings • Application Code • Warnings will be issued for incompatibles
    • 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
    • Model.objects.earliest() (latest() with reverse direction)
    • Model.objects.first() • Returns the first object from QuerySet • If no order specified, Ordered by PK • None for EmptyQuerySet
    • Model.objects.first()
    • Model.objects.last()
    • Model.objects.filter(timestamp__hour = 23) Model.objects.filter(timestamp__minute = 59) Model.objects.filter(timestamp__second = 59)
    • ModelAdmin.preserve_filters
    • HTML 5 Types for input fields (Email, URL and Number) Supported in • • • • • IntegerField FloatField DecimalField EmailField URLField
    • Blank Password is Supported
    • • • • • • 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/)
    • Notable Changes
    • • • • 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
    • Dropped Features
    • django.contrib.localflavor django.contrib.databrowse django.contrib.markup
    • Deprecated Features
    • • • • • • django.middleware.transaction.TransactionMiddleware django.db.transaction.autocommit django.db.transaction.commit_on_success django.db.transaction.commit_manually TRANSACTIONS_MANAGED (in settings.py)
    • • CACHE_MIDDLEWARE_ANONYMOUS_ONLY • SEND_BROKEN_LINK_EMAILS (django.middleware.common.BrokenLinkEmailsMiddleware)
    • django.contrib.comments
    • Django 1.7
    • In built migrations
    • Thank You! siva@sivaa.in bit.ly/sivaa_in bit.ly/sivasubramaniam
    • 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