Skip to content

ImaginaryLandscape/multipage-form-demo

Repository files navigation

Django Multipage ModelForm

This is a demonstration project for "django-multipage-form", an app that helps in the construction of Django model forms that span more than a single page.

Features

The "multipage_form" app helps you to separate sections of a long model form across several pages. For example, the "job application" app in this example project defines a section where applicants enter their personal information, another for employment expeience, and so on.

The app allows you to implement different branches or "routes" through the progression of form pages. Two users who respond in different ways on a given page may then be routed to different pages, depending the values entered.

The app also provides a tool that allows the user to return to a form page they have already completed, and a related tool that generates a summary of all completed form pages. These features allow the user to review and edit their responses before the final submit button is clicked.

System Requirements

Python 3

Installation

Create and activate a Python 3 virtual environment, and install dependencies with poetry:

(new_virtual_env)$ poetry install

This should install Django 3.2 and the "django-multipage-form" app.

Configuration

This project uses the file-based sqlite3 database that comes bundled with Django, so no special database setup is necessary. All you need to do is run the "migrate" management command to create the tables:

(new_virtual_env)$ ./manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, job_application, multipage_form, sessions
Running migrations:
  ...
  Applying multipage_form.0001_initial... OK
  Applying job_application.0001_initial... OK
  Applying job_application.0002_auto_20220211_0317... OK
  ...

Webpage

You should now be able to run the project with Django's built-in runserver command on port 8000 (or any available port).

(new_virtual_env)$ ./manage.py runserver 8000

You should then be able to use the app in your browser at localhost:8000. Fill in form fields with test data and have fun!

Admin

You should also be able to log into the Django admin at localhost:8000/admin.

Use the username "admin" and the password "1234" to log in as a superuser that was created when migrations were run. Form submissions should appear in the admin under the "job_application" app.

Use in Your Own Projects

For further details on how to use the "multipage_form" app in your own projects, please see that app's README:

https://github.com/ImaginaryLandscape/django-multipage-form

About

Demonstration code for a multipage Django form

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •