Add Python 3, Django 1.5.2 compatibility

Fixes Django 1.5.2 and Python 3 compatibility.