Skip to content Skip to sidebar Skip to footer

Coding Mental Block With Specific Django Task

I've been thinking of this for a LONG time the past few days and can't figure out with my current toolset how to implement this in Django. What I want is something that can be impl

Solution 1:

A pure django solution would be:

  • create a form with three integer fields (say, num1, num2 and result)
  • in your view, populate num1 and num2 with the numbers to be added
  • render the form in your template (num1 and num2 fields should be read only)
  • the user enters the answer in the result field and submits the form
  • in your view, determine whether num1 + num2 == result
  • redirect to a success page if the answer is correct, otherwise redisplay the form

Post a Comment for "Coding Mental Block With Specific Django Task"