Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7900051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:52:05+00:00 2026-06-03T08:52:05+00:00

I was following the tutorial online, but I am stuck when trying to conditionally

  • 0

I was following the tutorial online, but I am stuck when trying to conditionally show steps in my form wizard.

views.py

def silver_ad_selected(wizard):
        cleaned_data = wizard.get_cleaned_data_for_step('0') or {}
        return cleaned_data.get('ad_type') == '2'

def platinum_ad_selected(wizard):
        cleaned_data = wizard.get_cleaned_data_for_step('0') or {}
        return cleaned_data.get('ad_type') == '3'

class AddWizard(SessionWizardView):
        def done(self, form_list, **kwargs):
                return render_to_response('business/done.html', {
                        'form_data': [form.cleaned_data for form in form_list],
                })

urls.py:

add_forms = [AddForm1, AddForm2, AddForm3]

urlpatterns = patterns('listings.views',
    url(r'^addWizard/$', AddWizard.as_view(add_forms,
        condition_dict = {
                '2': silver_ad_selected or premium_ad_selected
        })),
.......

forms.py

class AddForm1(forms.Form):
        TYPE_CHOICES = (
                ('1','Basic'),
                ('2','Silver'),
                ('3','Platinum')
        )
        ad_type = forms.ChoiceField(choices=TYPE_CHOICES, widget=forms.RadioSelect)

class AddForm2(forms.Form):
        category = forms.ModelChoiceField(queryset = Category.objects.all())
        city = forms.ModelChoiceField(queryset = City.objects.all())
        name = forms.CharField(max_length = 200)
        address = forms.CharField(max_length = 200)
        slogan = forms.CharField(max_length=140)
        phone = forms.CharField(max_length=10)
        website = forms.URLField()
        email = forms.EmailField()

class AddForm3(AddForm2):
        twitter = forms.CharField(max_length=100)
        facebook = forms.URLField()
        description = forms.CharField(widget=forms.Textarea)

Basically, I only want to show the last step if the user chooses either the “Silver” option or the “Platinum” option, which is selected in step 1. Right now, no matter what I choose, only the first two steps/forms are shown.

I think that my silver_ad_selected and platinum_ad_selected methods might be the problem, but I am not sure.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:52:07+00:00Added an answer on June 3, 2026 at 8:52 am

    Try changing your urls.py:

    add_forms = [AddForm1, AddForm2, AddForm3]
    
    urlpatterns = patterns('listings.views',
        url(r'^addWizard/$', AddWizard.as_view(add_forms,
            condition_dict = {
                '2': lambda wizard: wizard.silver_ad_selected() or wizard.premium_ad_selected()
            })),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html in order to create a map view and
I'm very new to Git and I've been following this online tutorial for converting
For my first time using Xcode I was following a tutorial online. I did
I'm trying to use the example that comes in the slony tutorial but it
I'm following an online Win32::Gui tutorial to learn how to add a GUI to
I was following an online tutorial to create an Ruby on Rails application on
I am trying to try out the tutorial online and wanted to put the
I'm getting started with Ruby on Rails and am following an online tutorial. The
I am following a video tutorial in PHP (tutorial not available online for free)
I'm following a php video tutorial (it's not online sorry) from Lynda.com and used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.