user.is_authenticated replaced with request.user.is_authenticated