def setup_wanted(view_func, setup_url=None, redirect_field_name=REDIRECT_FIELD_NAME):
    """
    Decorator for views that checks that the user has completed the setup
    process, redirecting to settings.SETUP_URL if required
    """

    @wraps(view_func)
    def wrap(request, *args, **kwargs):
        if (
            not request.user.is_authenticated
            or request.user.account.has_completed_setup
        ):
            return view_func(request, *args, **kwargs)
        else:
            resolved_setup_url = resolve_url(setup_url or settings.SETUP_URL)
            path = request.get_full_path()
            return redirect_to_login(path, resolved_setup_url, redirect_field_name)

    return wrap

    Decorator for views that checks that the user has completed the setup
    process, redirecting to settings.SETUP_URL if required
    
accounts/decorators.py