Fix request.endpoint=None. Change csrf_protected on request to csrf_valid