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 8946031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:24:27+00:00 2026-06-15T12:24:27+00:00

today I’ve started using Form Wizard in django 1.4. The functionality seems to be

  • 0

today I’ve started using Form Wizard in django 1.4. The functionality seems to be nice, but according to the documentation, one need to pass the form_list (and condition_dict, when necessary) to the as_view method (which means urls.py) instead of providing it in the subclass of WizardView

This means writing some logics within urls.py and not views.py which I believe is against django pattern, as the views module is supposed to be responsible for views logics.

I’ve ended up with following:

# views.py
class MyWizard(SessionWizardView):
    _form_list = (
        ('init', forms.MyWizardFormInit), 
        ('newuser', forms.MyWizardFormNewUser),
    )
    _condition_dict = {
        'newuser': lambda wizard: (wizard.get_cleaned_data_for_step('init') or {}).get('existing_user') == 'False'
    }

and the urls.py:

url(.., MyWizard.as_view(MyWizard._form_list, condition_dict = MyWizard._condition_dict)),

which really looks silly and ridiculous.
Is there any correct way to prevent declaring logics in urls.py while keeping DRY ?

  • 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-15T12:24:28+00:00Added an answer on June 15, 2026 at 12:24 pm

    A slightly cleaner version might look like this:

    views.py

    my_wizard_view = MyWizard.as_view(MyWizard._form_list, condition_dict=MyWizard._condition_dict))
    

    urls.py

    url(r'^my_wizard/$', my_wizard_view, name='my_wizard')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I started to implement Google maps into my site, but I've ran into
Today I faced one interesting issue. I'm using the foursquare recommended python library httplib2
Today I generated a webservice client with CXF 2.6.1 (latest version), using the tool
I am reading a book about Javascript and jQuery and using one of the
Today, while I was randomly reading the JavaScript patterns O'Reilly book, I found one
today i forced to reinstall wamp on my pc. but i forgot to copy
Today, I ran into this weird problem with a user using Mac OS X.
Today I stumbled about a Problem which seems to be a bug in the
Today I experienced a very strange behavior with my XCode (using Version 4.2, iOS
Today I tried to use const indentifier, but I find the const variable can

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.