More django-mptt goodness: FilteredSelectMultiple m2m widget

If you are using django-mptt to manage content (eg heirarchical categories) then it needs a bit of help to make a nice admin interface. For many-to-many fields, Django provides the quite nice FilteredSelectMultiple widget (a two-pane selection list with search box) but it only renders ‘flat’ lists… if you have a big category tree it’s going to be confusing to know what belongs to what. Also, list items are sorted alphabetically by the js, which won’t be what you want.

In this post I’ll be extending FilteredSelectMultiple to show the tree structure in the list:

Read more of this post

Making admin bulk delete action work with django-mptt

For the past month and a half I have been learning Django (and therefore Python…) at my new job.

I’m very impressed how quick it has been to learn, and particularly with how complete and well thought-through the Django framework is. Python is nice too, I’m not missing all the $ signs, semi-colons and curly braces at all 🙂

For the project I’ve been working on we used django-mptt to manage a ‘Modified Pre-Order Tree Traversal‘ scheme for a heirarchical Category model.

django-mptt works great but to properly manage an mptt model in the django admin you have to do a bit of hacking:
Read more of this post