Fixed compatibility with Django version 1.5+