“Django supports adding custom methods for accessing the ORM through the ability to implement a custom Manager… The downside of this approach is that methods added to a manager can only be used at the beginning of the chain.”

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:

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🙂

I was looking around recently for a jQuery tooltip plugin. I wanted a bit more flexibility in styling the content of the tooltip than the ones I found though… basically I wanted more than just ‘title’ and ‘description’.

More of an informational panel than a little tooltip, hence ‘dataPanel’.

In the one I made you can have an arbitrary number of fields within the tooltip div – you just pass the plugin a css selector for each one when you attach it to your source element.

Compared to PHP, with its many helpful date functions, working with dates in Javascript is a pain in the neck.

The js Date object can parse some human-readable strings into a date, but with the rise of RSS etc (in my case it was working with Google gdata apis…) you’ll often be encountering ISO8601 date strings. Apparently ECMAScript 5 will include built in methods to parse this standard format, but until that’s available it’s a bit of a headache.