tags:

views:

17

answers:

1

i am working with a django quiz application where one question per page. when i will answer one question selecting a radio button and click submit button how can i get the next question in the next page as well as the answer will submitted to database. If anyone help me it would be an outstanding solution for me. please

Thanks for the answer , would you please i need bit specific answer. I wrote a view to get the question and render the answer in the radio link . but when i submit the answer how can i map the url to get dynamically new question each. thank you so much.

A: 

You need to write a view to handle your request. You need to edit urls.py to map your quiz url to the function in views.py (for your quiz app). So when a request with that quiz url comes Django applies that view function. So basically what this view does is this -

  1. Get the answer & store it to DB. The DB details you need to define in models.py
  2. Get the next question from DB (or wherever you store your questions).
  3. Have a template (for quiz questions) with place holders for quiz question.
  4. Form the new url & fill your template.
  5. Redirect the user to the new url.

That does it. If you need any specifics lemme know.

MovieYoda