Django multistep form

52 views
Skip to first unread message

Obodoma Uzondu Vincent

unread,
Nov 7, 2022, 4:58:01 AM11/7/22
to Django users
I have a multi-step form that is 3 steps but it has 4 forms. In the first form, the user has to choose from two choices. The user’s first form choices will determine the next form that will be displayed.
The code is not working as it should. The first form choices are radio buttons which are commercial and private. If the user chooses commercial it brings the next form and if the user chose private it brings a different form. My problem is that if the user chose private or commercial it brings the same form.
Views.py
template
forms.py
freesnippingtool.com_capture_20221107065544.png

Watson Cyrus Anikwai

unread,
Nov 7, 2022, 11:08:22 AM11/7/22
to django...@googlegroups.com
Following this as well. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f3fc2a20-0bea-4ba2-a9a2-c916ffec8ff7n%40googlegroups.com.

James

unread,
Nov 7, 2022, 1:21:03 PM11/7/22
to Django users
Hi,

Can you also link the relevant urls.py please?

Thanks!

David Nugent

unread,
Nov 7, 2022, 11:39:06 PM11/7/22
to django...@googlegroups.com
A quick reading of your code suggests that `form.customer_choices.choices` should be returned as an array with the state of each choice, so == here is probably not going to work.

--

Obodoma Uzondu Vincent

unread,
Nov 8, 2022, 12:17:17 AM11/8/22
to django...@googlegroups.com
from django.urls import path, include
from .views import step1formview, step2aformview, step2bformview, step3formview
from . import views





app_name = 'datacollector'

urlpatterns = [
   
    path('', views.step1formview, name="form1views"),
    path('customerinfo2a/', views.step2aformview, name="step2aformview"),
    path('customerinfo2b/', views.step2bformview, name="step2bformview"),
]

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Obodoma Uzondu Vincent

unread,
Nov 8, 2022, 12:17:51 AM11/8/22
to django...@googlegroups.com
I have sent the url

On Mon, Nov 7, 2022 at 7:20 PM James <jamesfra...@gmail.com> wrote:
--

Obodoma Uzondu Vincent

unread,
Nov 8, 2022, 10:08:23 AM11/8/22
to django...@googlegroups.com
Is it something like this : if form.customer_choices.choices['commercial', 'private'] == 'commercial':

Reply all
Reply to author
Forward
0 new messages