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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:28:30+00:00 2026-05-23T05:28:30+00:00

I’m displaying two separate sample projects. The first is a Contact related and shows

  • 0

I’m displaying two separate sample projects. The first is a Contact related and shows the principle of using the formwizard. The second is an ingredients to recipes related project which shows how to use inlines within a form. I want inlines to be in my formwizard the same way they work in a normal form.

I have a formwizard multistep form working. It is based off the example here. I’ve changed it slightly to use modelform.

models.py

from django.db import models

# Create your models here.
class Contact(models.Model):
    subject = models.CharField(max_length=50)
    sender = models.EmailField()

    def __unicode__(self):
        return self.subject

class Contact2(models.Model):
    message = models.TextField(max_length=500)

    def __unicode__(self):
        return self.message

forms.py

class ContactForm1(forms.ModelForm):
    class Meta:
        model = Contact

class ContactForm2(forms.ModelForm):
    class Meta:
        model = Contact2

class ContactWizard(FormWizard):
    @property
    def __name__(self):
        return self.__class__.__name__

    def done(self, request, form_list):
#        do_something_with_the_form_data(form_list)
        return HttpResponseRedirect('/done/')

urls.py

(r'^contact/$', ContactWizard([ContactForm1, ContactForm2])),

Separately I have inlines being generated into another form. I’m doing this via inlineformset_factory in my view. This is not connected to the formwizard example above. This is an ingredients to recipes example.
I’m doing this like:

views.py

def add(request):
    IngredientFormSet = inlineformset_factory(Recipe, Ingredient, 
                fk_name="recipe", 
                formfield_callback=curry(ingredient_form_callback, None))

    if request.method == 'POST':
        form = RecipeForm(request.POST)
        formset = IngredientFormSet(request.POST)
        if form.is_valid() and formset.is_valid():
            recipe = form.save()
            formset = IngredientFormSet(request.POST, instance=recipe)            
            formset.save()
            return redirect("/edit/%s" % recipe.id)
    else:
        form = RecipeForm()
        formset = IngredientFormSet()

    return render_to_response("recipes_add.html", {"form":form, "formsets":formset}, context_instance=RequestContext(request))

recipes_add.html

<form method="post">
{% csrf_token %}
    <table>
    {{ form }}
    </table>
    <hr>
    <h3>Ingredients</h3>
    <div class="inline-group">
      <div class="tabular inline-related last-related">
          {{ formsets.management_form }}
          {% for formset in formsets.forms %}
          <table>
              {{ formset }}
          </table>
          {% endfor %}
      </div>
    </div>
    <p class="success tools"><a href="#" class="add">Add another row</a></p>
    <input type="submit" value="Add">
</form>

How can I get the inlines to work within my formwizard multistep form?
The models.py now looks like this because I want books to be inlines to contact. I want the inlines to be on the first step of my formwizard. Then go through to step 2 and finish.

from django.db import models

# Create your models here.
class Contact(models.Model):
    subject = models.CharField(max_length=50)
    sender = models.EmailField()

    def __unicode__(self):
        return self.subject

class Contact2(models.Model):
    message = models.TextField(max_length=500)

    def __unicode__(self):
        return self.message

class Book(models.Model):
   author = models.ForeignKey(Contact)
   title = models.CharField(max_length=100)
  • 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-23T05:28:31+00:00Added an answer on May 23, 2026 at 5:28 am

    The formwizard included in Django (below version 1.4) doesn’t support formsets. Beginning with version 1.4, there will be a much better implementation (see https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/)

    Back to your question, if you can’t wait for the next Django release – which I assume – you could stick to django-formwizard. The last release (1.0) is api compatible to the upcoming Django formwizard.

    With the new formwizard implementation you can use FormSets the same way you use normal Forms.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to

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.