outreachy / website

Code for the Outreachy website, based on Python, Django, and Bootstrap.
https://www.outreachy.org
GNU General Public License v3.0
246 stars 235 forks source link

Django-formtools 2.4 update causes infinite recursion on initial application #537

Open sagesharp opened 1 year ago

sagesharp commented 1 year ago

Background

Outreachy is an internship program to support diversity in open source. We use django-formtools to create a multi-step application form.

The Outreachy initial application form has 14 different steps. Which steps are shown depends on the information the applicant gives us in earlier steps.

For example, we remove two form pages if the person isn't a student, since only students need to fill out their school information and school term time commitments. We also remove a page that asks about the person's employment dates unless the applicant says they are currently employed (or will be).

All Outreachy applicants have to fill out this application form. We receive over 3,000 applications per internship cohort (6,000+ per year). Many applicants are not native English speakers. Being able to customize our form so that less text is shown is essential. Otherwise our small Outreachy organizer team of three will be very overloaded with applicant questions. :sweat_smile:

Breaking django-formtools change

In django-formtools 2.4, a bug fix was made that solved an issue for some usage cases of django-formtools, but broke our usage case.

Reproducing the bug

The full developer environment installation instructions are here.

The short version is:

git clone -b 2022-12-django-formtools-example https://github.com/outreachy/website.git
cd website
pipenv install
pipenv shell
npm install
./manage.py migrate
./manage.py createsuperuser

Reproducing the bug with tests

The Outreachy initial application form has unittests in home/test_eligibility.py. You can run those tests with this command:

PATH="$PWD/node_modules/.bin:$PATH" ./manage.py test home.test_eligibility

Reproducing the bug via web interface

You'll need to create a new Outreachy internship cohort in order to access the application form. You can do that via the Django shell:

$ ./manage.py shell
>>> from home import scenarios
>>> scenarios.InitialApplicationsUnderwayScenario()

Exit the Django shell and run the local webserver:

$ PATH="$PWD/node_modules/.bin:$PATH"  ./manage.py runserver

Go to localhost:8000/eligibility. Log in using your superuser credentials (or create a new account, the account verification link will be printed in the server log). Fill out your name, legal name, and sign your name to the Outreachy Code of Conduct form at the end of the page.

Once you log in, you'll be redirected to the application form, which currently fails with the recursion error.