django-formtools icon indicating copy to clipboard operation
django-formtools copied to clipboard

Access URL Parameters in WizardView Templates

Open DanielAlderman opened this issue 2 years ago • 0 comments

Hi there,

I was wondering what is the recommended way of passing URL Parameters into the template of a WizardView?

This is done automatically in templates of generic Django views such as a ListView, I am able to use URL Parameters simply by using the name of the capture parameter.

For example if my URL is defined as path('<location>/', views.CustomerIndexView.as_view(), name='customer_index'),

Then I can access that captured value simply using {{ location }} in my template.

This does not work in the template of a WizardView or one of its descendants. Looking at the kwargs of the view I can see that the captured value is present, but it isn't passed as context to the template, is this by design?

DanielAlderman avatar May 04 '23 12:05 DanielAlderman