开发者

how can i get a next form/page while submitting a form?

开发者 https://www.devze.com 2023-01-19 03:14 出处:网络
i am working with a django quiz application where one question per page. when i will answer one questionselecting a radio button and click submit button how can i get the next question in the next pag

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 开发者_C百科i submit the answer how can i map the url to get dynamically new question each. thank you so much.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消