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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:42:45+00:00 2026-05-30T21:42:45+00:00

I am developing a dynamic form based on user selection. It is a two-staged

  • 0

I am developing a dynamic form based on user selection. It is a two-staged process: first the user selects from a list of radio buttons and depending on that selection, the user will be presented with appropriate form fields. I know how to do that using type, but I am using 2 different forms (1 for initial selection and 1 for the custom form fields), and 2 different views.
I have two questions:
1) is it right to separate these 2 forms and there views?
2) once the user has filled the 2nd (custom) form, how can I know at run time which fields
were presented to her in order to create the object and save it into the DB?

class SelectionForm(forms.Form):
    choice = forms.ModelChoiceField(queryset=Fruit.objects.filter(...)
                                     widget=forms.RadioSelect,
                                     initial='')

# views.py
def review(request):
    if request.method == 'POST':
        form = SelectionForm(request.POST)

        if form.is_valid():
            user_choice = form.cleaned_data['choice']

            return HttpResponseRedirect('/new_order/%s' % (user_choice))
    else:
        form = SelectionForm()

    return render_to_response( '/new_order.html', {'form': form} )

def order_fruit(request, user_choice):
    if request.method == 'POST':
        """
        make_order_form uses Python type to create a form
        depending on user_choice
        """
        form = make_order_form(request.POST, user_choice)

        if form.is_valid():
            # How to know which fields were presented to the user -
            # in order to create the Order object with the right -
            # arguments ????????????????????

            return HttpResponseRedirect('/thanks/')

    else:
        form = make_order_form(request, user_choice)

    return render_to_response('/second_step_order.html', { 'form':form })
  • 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-05-30T21:42:47+00:00Added an answer on May 30, 2026 at 9:42 pm

    Introspect your form. Have a look inside ‘form.fields‘ or ‘form.cleaned_data‘.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a dynamic data web app. On list.aspx page it has GridViewPager control
I'm developing a web service whose methods will be called from a dynamic banner
I have dynamic grid-based tables in the application I am developing. The following code
I'm in the process of developing a website in html5, its pretty dynamic, meaning,
I am currently developing a dynamic RSS feed that will automatically pull articles from
I'm developing an aplication that loads a dynamic color from a XML file. In
When developing a C/C++ (=2?) plugin based framework with shared objects/dynamic libraries that need
I'm developing a chrome extension where I need to create dynamic sub-contextMenus based on
For my university project, I'm developing a dynamic live chat website with rooms, user
Hi I am developing a Qt application that uses a plugin (dynamic library) and

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.