lots of fixes to bring custom templates into sync with requirements of django 1.7b1