The Web framework for perfectionists (with deadlines). Django makes it easier to build better Web apps more quickly and with less code.
Free online book: DjangoBook
With the release of Django 1.5, there's no better time to dive into Django, and Python for that matter if your new to that too. I've been using Django since it's 1.2 release, and each release since has been nothing short than amazing. Each new feature is delicately thought out, designed, and implemented. Another positive about using Django is it's release and deprecation cycle. You will have at least 2 major versions to update any APIs which are being deprecated. You will receive friendly warning at first, then errors, then it just plain won't work. This usually provides sufficient time to upgrade your application's APIs and do any testing.
If you've used previous versions of Django, there isn't a lot to learn in this new version, and you can use most of what you already know from previous versions of Django. The major new features include a customizable User model, experimental support for Python 3, saving a subset of a model's fields, better support for streaming responses, and GeoDjango now supports PostGIS 2.0. One of the new features you will be using on a regular basis in templates, is the new url template tag. In previous versions of Django, you were encouraged to load this tag from future, now in 1.5, you don't need to load it from future and it's now the default. The first argument of this template tag now accepts both a string and a context variable. This can allow you to change the URLs at template rendering time, I haven't personally used the URL tag with a context variable yet, haven't found a use for it. Other tags which were formatted inconsistently were also updated such ssi, and I haven't used this tag in a single application yet.
First I will touch base with the customizable User model... I wouldn't recommend it, as it can break third party apps which have not yet upgraded to the Django 1.5 code base. If you are a Django third party app developer who would like to support Django 1.5(and also break support for anything below it), then here's what you need to know. First, when linking your models to the User model, do not link directly. Instead, you need to import a special function, which will ask Django what the current User model is... Yes, I know this is poorly implemented. There should have been a proper release cycle for releasing this feature. Such as releasing the function first, then the customizable User model a few versions after developers have implemented the new function. I do not recommend using this unless your project absolutely requires a fully customized User model, and you are either prepared to make modifications to third party apps, or don't plan on using many third party apps. That being said, tread carefully into these waters when designing your application.
Saving a subset of a model is now possible using the new keyword argument update_fields passed to the Model.save() method. Best of all, if you retrieve only a subset using .only() or .defer(), the queryset will remember this and only save that subset back... Awesome, isn't it? Really makes up for a totally broken customizable User model we got.
Here's one feature that should've been in the ORM earlier on... The caching of related model instances... Yeah, prior to Django 1.5, unless you were an expert at using the caching framework and properly using the with template tag, you would hit the database more times than you can count. So if you don't understand how to use caching in your application, move away from previous versions of Django and use this one. Your RDBMS and/or DBA will thank you for it, and so will your website visitors, as the page load times will increase.
The support for explicit streaming responses is now supported, prior to this, streaming responses were possible by using an iterator, which at times was unreliable, if say a middleware accessed the content attribute. The new StreamingHTTPResponse class should fix that.
A needed update to the Django documentation has also been released with 1.5. The Django documentation takes on a different format in the contents page, and there are new tutorials added, such as How to write reusable apps, which should help a large amount of developers.
A notable minor feature is an update to how the LOGIN_URL and LOGIN_REDIRECT_URL in the Django settings work. You can still be wet about it and provide a full URL path to those pages, or be more dry, and use the view names instead. This also rules out any possible errors, if you manually enter in the URL string yourself, having Django to a reverse for it makes it less error prone. Just be sure to type out auth_login correctly.
There are many minor features which may be of interest to you, so if you have time do take a look at the release information. There are some backward incompatible changes(if they never added these things in the first place, we wouldn't have to worry about these now would we...). Something which has been added to all Django versions as a security update is ALLOWED_HOSTS in the settings, which is now required. Now why didn't they think of this in the first place, it only makes sense. Some of the date-based classed views have been updated to change how the year context variable works, so if you use these views in your application do be sure to update your templates. A somewhat big backward incompatible change is that simplejson is no longer used. There is a good number of third party apps out there that use this to serialize JSON requests for AJAX and such. Be sure to update this to use json from the standard python library instead.
- Experimental Python 3 support
- Support for model subset saving
- Caching is related model instances
- The addition of the verbatim template tag
- New tutorials(finally)
- LOGIN*URL settings now accept DRY urls
- Customizable User models is poorly implemented