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

Make step url or get_step_url() available to templates #273

Open
thenewguy opened this issue Apr 22, 2024 · 0 comments
Open

Make step url or get_step_url() available to templates #273

thenewguy opened this issue Apr 22, 2024 · 0 comments

Comments

@thenewguy
Copy link
Contributor

It is complicated to generate step urls for wizard navigation in a reusable fashion while iterating {% for step in wizard.steps.all %} in templates for wizards that implement a custom get_step_url() method . The url reversal can require extra references and to complicate matters further, these references might not be available to the template.

One can work around this by adding extra context variables for the template to use, but this isn't very DRY when the wizard already knows how to reverse its urls with just a step name.

It would be helpful if the value from WizardView.get_step_url(step) was available to the template.

A few approaches that come to mind:

  • StepsHelper could return an object with a step.url property instead of requiring a manual {% url wizard.url_name step=step param1=param1.some.ref param2=param2.some.ref param3=param3.some.ref ...etc... %}
  • The view could be passed into the context and a template filter could be offered that accepts the step as an argument and pulls the view from context to use wizardview.get_step_url()
  • A step url map could be passed into the template via context and a template filter could pull from there
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

No branches or pull requests

1 participant