Use domain request wizard instead

This is a much better solution as we need to use this in the request experience anyway. This works towards that, but requires a bit of a refactor.
This commit is contained in:
zandercymatics 2024-09-19 15:12:29 -06:00
parent 3127f64183
commit a70d9d300d
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
7 changed files with 335 additions and 286 deletions

View file

@ -4,7 +4,7 @@ from itertools import zip_longest
from typing import Callable
from django.db.models.fields.related import ForeignObjectRel
from django import forms
from registrar.utility.enums import Step
from registrar.models import DomainRequest, Contact
@ -278,3 +278,16 @@ class BaseYesNoForm(RegistrarForm):
# No pre-selection for new domain requests
initial_value = self.form_is_checked if self.domain_request else None
return initial_value
def request_step_list(request_wizard):
"""Dynamically generated list of steps in the form wizard."""
step_list = []
for step in Step:
condition = request_wizard.WIZARD_CONDITIONS.get(step, True)
if callable(condition):
condition = condition(request_wizard)
if condition:
step_list.append(step)
return step_list