Have more time? There’s a lot more you can do:
You probably have some repetitive text in the HTML templates (for any page headers/footers/etc). Make a base template and have your other templates inherit from this.
As a hint: you’ll probably want at least two “blocks” one for the page title, in the head section, and one for the content of the page.
Make your system able to handle more than one survey — we’ve provided a second survey in surveys.py, and provided a dictionary mapping a survey “code” to the survey object.
Add a page that lets the user pick the survey they want to fill out: it should list the available surveys. It should then take you to the start page you made earlier, except for this survey.
You’ll need to figure out a good way to keep track of the survey the user is filling out as they move through the system.
The personality quiz survey uses a new feature of the surveys: one of its questions is marked as allowing comments. For this question, you should show the radio buttons of the choices, as usual, but also a multiline text box where the visitor can enter a comment.
You should keep track of the textual comments as well as the radio-button choices. Figure out a good data structure to keep track of these things.
Remake your “thanks!” page that is shown at the end of the survey—instead of just saying “thanks”, it should list each question and the provided answer (including any comments), like this:
We don’t want users to submit a survey more than once.
Of course, you could put something in the session that says they’ve completed that survey, and check for that, but the cookies that support the session typically only last as long as the browser is running — a user who quits their browser could re-answer the survey.
Figure out a way you could prevent a site visitor from re-filling-out a survey using cookies.
Finish all of these? Want more challenges over the weeeknd? Here are lots of potential ideas to polish this: