Django 1.5 compatibility

Minor changes to make it play nice with `Django` 1.5

Cheers,

Pierre