feat: allow dynamic prevent-going-back conditions#947
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the prevent going back directive so it can be driven by a dynamic Python expression (similar to back button), allowing the “Back” navigation to be conditionally enabled/disabled per question render.
Changes:
- Parse
prevent going backas either a boolean or an evaluatable Python expression and computecan_go_backat ask-time. - Plumb
can_go_backthrough the question result payload intoInterviewStatus. - Update HTML rendering to respect
status.can_go_back(evaluated) instead ofquestion.can_go_back(could be a code object).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docassemble_base/docassemble/base/standardformatter.py | Uses evaluated status.can_go_back to decide whether to render the back button. |
| docassemble_base/docassemble/base/parse.py | Computes/evaluates dynamic “prevent going back” conditions and propagates the result into InterviewStatus. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <copilot@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes
prevent going backwork likeback buttonor other interview keys that evaluate a Python expression for truthiness. It works on one line, or with a scalar.or
In my case, I want this added because I want to be able to do this for development so that I can go back, but my users in production can't: