Make compatible with django1.7