updating code for django 1.6