News for hackers. Stuff that matters.
Re:Django 1.4 final released by bryanh on Friday March 23, 2012 @01:30PM (#3746183)
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.
Re:Django 1.4 final released by trun on Friday March 23, 2012 @02:21PM (#3746437)
Time zone support! This has always been one of the most painful things to manage IMHO. Also this little gem caught my attention...

  * The if template tag now supports {% elif %} clauses.
Re:Django 1.4 final released by lightcatcher on Friday March 23, 2012 @10:58PM (#3748321)
I've found using Jinja2 templates (http://jinja.pocoo.org/docs/ ) is a lot easier than dealing with the Django template language. Django also makes switching template languages quite easy.
Re:Django 1.4 final released by jawr on Saturday March 24, 2012 @03:35PM (#3750447)
I believe Jinja2 is also a lot quicker, but the Django developers want to catch up.. so that's something.
Re:Django 1.4 final released by jd on Friday March 23, 2012 @02:26PM (#3746460)
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.

Re:Django 1.4 final released by ubernostrum on Friday March 23, 2012 @02:37PM (#3746507)
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.
Re:Django 1.4 final released by notyourwork on Saturday March 24, 2012 @11:18AM (#3749556)
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.

Re:Django 1.4 final released by amccloud on Friday March 23, 2012 @02:47PM (#3746547)
Re:Django 1.4 final released by joelhaasnoot on Friday March 23, 2012 @06:14PM (#3747624)
And bulk updating also doesn't run any signals or the save method...
Re:Django 1.4 final released by gtaylor on Friday March 23, 2012 @09:52PM (#3748190)
Nor should it. It's for inserting a bunch of stuff, really fast. You can just do normal saves if you want to call the save() method.
Re:Django 1.4 final released by amccloud on Friday March 23, 2012 @01:52PM (#3746309)
I've created a project template that I consider - and hope - is an improved project template for most.

http://amccloud.com/post/14689947527/django-1-4-custom-proje...

Re:Django 1.4 final released by zalew on Friday March 23, 2012 @01:35PM (#3746212)

   * *args and **kwargs support for template tag helper functions
Re:Django 1.4 final released by olofsj on Saturday March 24, 2012 @05:28AM (#3748916)
Another new thing you didn't mention is the new list filter framework for the admin. I've found it really useful in my projects.
Re:Django 1.4 final released by bmelton on Friday March 23, 2012 @02:15PM (#3746403)
All heavy hitting features. I've been begging for "SELECT FOR UPDATE" support forever, and django-bcrypt is in my bootstrap requirements.txt.

Does anybody have any reference to the scaffolding features? This might be the first I've heard of it.

Re:Django 1.4 final released by jacobian on Friday March 23, 2012 @02:19PM (#3746429)
Does anybody have any reference to the scaffolding features? This might be the first I've heard of it.

Yeah, see https://docs.djangoproject.com/en/1.4/ref/django-admin/#djan... and https://docs.djangoproject.com/en/1.4/ref/django-admin/#djan....

It's really very simple: you just create a directory of files and point startproject/startapp to that directory with the --template flag. Files are copied over into the new app/project, with some simple replacements for things like the project name.

You can check out Django's source for the built-in one, or if you poke around on Github you'll find some others. Here's one, for example: https://github.com/amccloud/django-project-skel/.

Re:Django 1.4 final released by izak30 on Saturday March 24, 2012 @12:46PM (#3749825)
Django-bcrypt should still be installed with those old projects while you upgrade. Be careful with that there are some gotchas
Re:Django 1.4 final released by goggles99 on Sunday March 25, 2012 @03:20AM (#3751955)
Cool, finally has what the big players have had for over 5 years (10 for some of the new features).