

Django 1.4 final released - pythonist
https://www.djangoproject.com/weblog/2012/mar/23/14/

======
bryanh
Release notes here: <https://docs.djangoproject.com/en/dev/releases/1.4/>

Some things to really dig:

    
    
        * better password hashing (bcrypt, etc...)
        * time zone support
        * built in selenium testing support
        * bulk insert Models
        * prefetch_related() (efficiently join m2m)
        * SELECT FOR UPDATE support
        * easy signing of cookies
        * better project templates (basic scaffolding)
    

There are lots more... big release. Thanks to the all folks behind it.

~~~
jd
It's a great release, but bulk_insert is really really dangerous because it
apparently doesn't call the save() method nor the pre_save or post_save
signals.

I don't like this because a lot of us put validation logic in Model#save and
use the signals to trigger the search indexer, and so forth. This behavior is
definitely going to catch some people off guard and it's bound to lead to
serious bugs.

I understand why they don't call Model#save for every object, but I think they
should have introduced something like Model#validate which is called before
every save (including the new bulk inserts) so you still get a place to put
custom validation logic that you _know_ will get called the moment something
is placed in the database. So now inserts are faster but at the expense of
correctness. I'm not convinced that's a good trade off.

Oh, and for some reason bulk updates are completely missing, even though it
seems natural to add bulk_insert and bulk_update at the same time.

~~~
ubernostrum
This is the correct behavior, really. Bulk insert is _not_ for cases where you
have complex per-record validation or processing logic that also needs to be
run in the application layer. It's for "I have all this data ready to go, now
just shove it in there as efficiently as possible". If you need to have
validation and additional per-record processing, signals, etc., insert the
objects through the ORM normally. Yes, it'll be slower, but that's the price
you pay for doing per-record processing.

~~~
notyourwork
To add to this, you could write your own validation method for a model and
have your model's save method call this.

When processing bulk data sets you can iterate over calling your own
validation then perform bulk insert knowing its validating. And your save will
still validate as before.

------
Mizza
For anybody interested in trying out the new templating system, this one has
been active for a little while now and is based on the work of Mozilla and it
has HTML5 boilterplate + Twitter bootstrap already, as well as Jinja2, Sphinx,
Django-Admin-Panel, Markdown, Celery, South and some other niceties:

Check it out: <https://github.com/xenith/django-base-template>

or just..

    
    
        django-admin.py startproject --template https://github.com/xenith/django-base-template/zipball/master --extension py,md projectname

~~~
amccloud
I made a template that I mentioned above that is a bit simpler and is self
documenting.

    
    
        django-admin.py startproject --template  https://github.com/amccloud/django-project-skel/zipball/master --extension py,md yourprojectname

------
RegEx
Any recommended resources on getting started with Django, or are the official
docs sufficient?

~~~
spdy
The official docs are more than sufficient. They were one of the main reasons
i picked up Django. Or you can watch the following:

Introduction to Django <http://pyvideo.org/video/604/introduction-to-django>

and if you want to venture further down the rabbit hole

Django in Depth <http://pyvideo.org/video/610/django-in-depth>

~~~
ashconnor
The slides for "Introduction to Django" really need to be published. That
video is impossible to follow without them.

------
silent1mezzo
Here's a good list of changes [http://procrastinatingdev.com/django/most-
important-changes-...](http://procrastinatingdev.com/django/most-important-
changes-in-django-1-4/)

------
BonoboBoner
Dear prefetch_related(), my M2M-relationships have been waiting for you for
soo long, glad you are finally with us.

------
dougbarrett
Man, I just went through the 1.3 tutorial TWO days ago. Does anyone that uses
Django know if the changes are huge? I guess I will be going through the 1.4
tutorial this afternoon.

~~~
zalew
[https://docs.djangoproject.com/en/dev/releases/1.4/#backward...](https://docs.djangoproject.com/en/dev/releases/1.4/#backwards-
incompatible-changes-in-1-4)

~~~
dougbarrett
Thank you! Everything I read went over my head, which is good since it means I
haven't gotten that far yet :)

~~~
zalew
good for you, happy coding then ;)

------
ineedtosleep
I have a Django app in its early stages using 1.3, would it be a good idea to
just transfer it over to 1.4? The only third-party app that it is using is
django-registration...

~~~
joelhaasnoot
Try it and see - if you're not using virtualenv - you should be. If it doesn't
seem compatible, just install 1.3 back.

------
melvinng
Damn, I just wasted 1 month rewriting a password hashing app.

~~~
bmelton
Hopefully not bcrypt, since dwaiter already has that one solved with django-
bcrypt[1].

[1] - <https://github.com/dwaiter/django-bcrypt>

------
kmfrk
Does anyone know a good way to find out whether your Django packages will
break or work fine? I am currently using these:

    
    
        django-registration
        django-secure

~~~
mace
1\. Check the docs and release history of the projects/apps; if they have not
been updated prior to v1.3, it's likely to break with v1.4.

2\. Run the test suite of the apps.

3\. Run the apps with v1.4 and warnings turned on via:

    
    
       python -Wall manage.py runserver.  
    

Not only will you quickly see what's broken, but Django will dump helpful
deprecation warnings for things that will eventually break at some point.

------
5h
Congrats all, new project due to be live in a month or so I'll keeping an eye
on updates and might make the jump asap

------
slig
I remember seeing that they would deprecate the {% url 'name' %} template tag
without quotes. What happened to that?

------
jtchang
Congrats to the team. Will have to check it out in the next few days.

------
halayli
I wish Django uses sqlalchemy as the default ORM instead of inventing a
squared wheel.

~~~
kennu
How's SQLAlchemy working with MongoDB? I, for one, am very happy to be able to
use MongoDB as a Django backend. I believe this is largely due to the fact
that Django has never directly assumed data models to be stored in a SQL
database, but has defined its own object abstraction layer instead.

~~~
halayli
You cannot have a sane ORM that works with nosql and sql databases without
compromising features & complexity.

I am glad sqlalchemy deals with sql-only databases.

You don't need an ORM for nosql. A library suffice.

~~~
batista
_You cannot have a sane ORM that works with nosql and sql databases without
compromising features & complexity._

Well, people don't need all the features all the time.

Else, they would use Oracle and not MongoDB.

In the same logic, they get by with Django ORM just fine.

As for the complexity, I don't think anyone ever called it complex...

