One of Django’s great strengths lie in its abundant library of 3rd party “pluggable” Need a blog? Grab a few pluggable apps to get you off your feet. The only problem is… they’re so hard to find and keep track of. That’s what we’re here for. We do the work of making sure you’re keeping your pluggables up-to-date.
A little while back I released a couple of Django apps to the world, and I’ve got a couple more in the pipeline, so I’ve been thinking a bit about best practices for making them as easily reusable as possible.
You won't see this in the Django documentation, you won't see it mentioned on other blogs, and you certainly won't hear the core developers of Django boasting about it, but Django's ORM has a secret weapon: it supports SQL group_by and having clauses, and it has for quite some time.
Nobody that I've seen has come out and actually said that they don't like database triggers, but at the same time, Python (Django) programmers like to program in Python. And PL/pgSQL certainly is not Python. There's a tendency to do everything in Python--especially with the use of Django's dispatcher.
Pinax is an open-source collection of integrated, but reusable apps for the Django Web Framework.
By integrating numerous reusable Django apps to take care of the things that many sites have in common, it lets you focus on what makes your site different.
I am putting together a quick app that will need to do basic user signup, email verification, account activation, and authentication. I know all that of that pretty much available out of the box with DJango, but I am hoping that somewhere someone has put together a generic project that has all the user management stuff in it so I don’t have to start from scratch.
Rather than trying to extend or override Model.save(), if the special action you require only affects one field then define a subclass of the required Field type and define a pre_save() method on the subclass. This will override the default method, which simply returns the attribute value.
When you make the ModelAdmin class in admin.py you can then override the default queryset method. So say for example you have a set of articles and you only want users to be able to edit articles they have originally posted.