fixed Python 3 and Django 1.7 compatibility