Creating the survey detail pages
The second URL mapping we added to our project's URL configuration was for the survey detail pages. Implementing this view is a little more complicated than the home page view since quite different data will need to be presented depending on the state of the requested survey. If the survey is completed, we need to display the results. If the survey is active, we need to display a form allowing the user to participate in the survey. If the survey is upcoming, we don't want the survey to be visible at all.
To do all of that at once, without testing along the way to verify we are headed in the right direction, would be asking for trouble. It's best to break the task down into smaller pieces and test as we go. We'll take the first step in that direction in the following sections.
Refining the survey detail view
The first thing to do is to replace the simple placeholder view for the survey detail page with a view that determines the requested survey's state and routes...