8 ms·
Release notes here: https://docs.djangoproject.com/en/dev/releases/1.4/ https://docs.djangoproject.com/en/dev/releases/1.4/ Some things to really dig: * b
by bryanh 15y ago
Release notes here: https://docs.djangoproject.com/en/dev/releases/1.4/ 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.
- zalew 15y ago* *args and **kwargs support for template tag helper functions
- amccloud 15y agoI'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-project-template http://amccloud.com/post/14689947527/django-1-4-custom-proje...
- bmelton 15y agoAll 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.
- jacobian 15y agoDoes 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/#django-admin-startapp https://docs.djangoproject.com/en/1.4/ref/django-admin/#djan... and https://docs.djangoproject.com/en/1.4/ref/django-admin/#django-admin-startproject 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/ https://github.com/amccloud/django-project-skel/.
- izak30 15y agoDjango-bcrypt should still be installed with those old projects while you upgrade. Be careful with that there are some gotchas
- trun 15y agoTime 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.
- lightcatcher 15y agoI've found using Jinja2 templates (http://jinja.pocoo.org/docs/ http://jinja.pocoo.org/docs/ ) is a lot easier than dealing with the Django template language. Django also makes switching template languages quite easy.
- jawr 15y agoI believe Jinja2 is also a lot quicker, but the Django developers want to catch up.. so that's something.
- jd 15y agoIt'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 15y agoThis 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 15y agoTo 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.
- amccloud 15y agoBulk updating already exists. https://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once https://docs.djangoproject.com/en/dev/topics/db/queries/#upd...
- olofsj 15y agoAnother new thing you didn't mention is the new list filter framework for the admin. I've found it really useful in my projects.
- goggles99 15y agoCool, finally has what the big players have had for over 5 years (10 for some of the new features).