Fixed compatibility with django 1.6