Fix errors related to django1.7