Fixed some deprecation warnings introduced in django 1.6