Add compatibility with Python 3.2/2.7 and Django 1.5/1.4