template fixes for django 1.6, #396