Skip to main content

An extension to the official Django form wizard supporting multiple forms on a wizard step.

Project description

https://badge.fury.io/py/django-multipleformwizard.png https://travis-ci.org/vikingco/django-multipleformwizard.svg?branch=master https://coveralls.io/repos/vikingco/django-multipleformwizard/badge.svg?branch=master

An extension to the official Django form wizard supporting multiple forms on a wizard step.

Documentation

The full documentation is at https://django-multipleformwizard.readthedocs.org.

Quickstart

Install django-multipleformwizard:

pip install django-multipleformwizard

Then use it in a project:

import django-multipleformwizard

Example use

from __future__ import unicode_literals

from django import forms
from django.shortcuts import render_to_response

from multipleformwizard import SessionMultipleFormWizardView

from .forms import Form1, Form2, Form3

class Wizard(SessionMultipleFormWizardView):
    form_list = [
        ("start", Form1),
        ("user_info", (
            ('account', Form2),
            ('address', Form3)
        )
    ]

    templates = {
        "start": 'demo/wizard-start.html',
        "user_info": 'demo/wizard-user_info.html'
    }

    def get_template_names(self):
        return [self.templates[self.steps.current]]

    def done(self, form_dict, **kwargs):
        result = {}

        for key in form_dict:
            form_collection = form_dict[key]
            if isinstance(form_collection, forms.Form):
                result[key] = form_collection.cleaned_data
            elif isinstance(form_collection, dict):
                result[key] = {}
                for subkey in form_collection:
                    result[key][subkey] = form_collection[subkey].cleaned_data

        return render_to_response('demo/wizard-end.html', {
            'form_data': result,
        })

History

0.1.0 (2015-03-02)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-multipleformwizard-0.1.9.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file django-multipleformwizard-0.1.9.tar.gz.

File metadata

File hashes

Hashes for django-multipleformwizard-0.1.9.tar.gz
Algorithm Hash digest
SHA256 10d31347c0d5028a471e298d49c0118229a35ccdfee5f4c72758098c28da5bde
MD5 83f02fbd1e99d3c72dd27916197f8660
BLAKE2b-256 54f5d19c3e1b4bf3465f66ebc4ea29a59cf026e070a97e0f9b411a9a4d16e571

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page