Friday, February 11, 2011

HW5: Survey Question Management

In this homework you will implement the basic survey question creation, listing, answering, and summarizing capabilities. Specifically, you will extend the previous webapp to have the following features.

  1. Any logged-in user will be able to create a survey question at /survey. A question consist of the text of the question and up to five different answer choices. If the user leaves some of the choices blanks then the question will ignore these and have fewer answer choices. Only logged-in users can create questions.
  2. You will give each question its own unique url of the form /1234, for any integer number. That is, use a counter that is incremented by 1 every time a question is created. Use a transaction, as explained in class, to increment this counter. If you are feeling up to it, try implementing a counter that uses A-Za-z0-9 as the digits (this is optional).
  3. The /user/<username> page will list all the questions that username has created, along with his name. This page is viewable by anyone. If someone clicks on one of the questions he is taken to the page for that question.
  4. If a user visits the page of one of the questions he created (/1234) then he sees the question but he cannot submit the answers. Instead, next to each choice is the number of times others have submitted that choice. Also at the end of the page, the owner of the question will see a 'Delete' button. If he clicks on it the question is deleted.
  5. If either an anonymous (non-logged in) or a non-owner user visits a question page he can provide an answer. However, if he has already provided an answer he cannot give another answer and instead sees the number of submitted answers. You can use the IP number of the client to keep track of who has already submitted a question, see self.request.remote_addr.

This homework is due Monday, February 21 @11am, you can turn it in here. You do not need to upload your CSS files.

1 comment:

  1. For point 3, I was thinking that that page will list links to the actual question page. The text of the link would be the question text (not the answer choices).

    ReplyDelete