Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ManagementForm to validate current_step #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jsma
Copy link
Contributor

@jsma jsma commented Oct 29, 2022

Previously, bots could and would stuff this form value with all kinds of nonsense, triggering a server error (and subsequent alert emails). Supersedes #47 and should fix #38

Previously, bots could and would stuff this form value with all kinds of nonsense, triggering a server error (and subsequent alert emails).
Supersedes jazzband#47
jsma added a commit to jsma/django-formtools that referenced this pull request Nov 3, 2022
This removes the undocumented `get_form_list` since the process of repeatedly and dynamically generating an OrderedDict of steps/forms pairs leads to infinite recursion.
This is replaced with a new method `process_condition_dict` which directly modifies `form_list` in place, in a single step executed prior to dispatching to `get` or `post`.
This eliminates infinite recursion since the `form_list` is calculated exactly once prior to any other attempts to access and process forms.
Removed `test_form_condition_unstable` since this is an odd test (why would a condition_dict return value suddenly change in the middle of a request/response cycle?) that was attempting to deal with invalid steps (invalid steps are better handled through actual validation, see jazzband#224).
For users who need to dynamically _add_ forms, this can be handled by overriding `process_condition_dict`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formtools chokes when ‘current_step’ has unexpected value
1 participant