Change code structure to fit django 1.5