Mathematics app exercise¶
Calculate exercise views.
- class MathCalculateChoiceView(**kwargs)¶
Bases:
TemplateView
Select params math calculation task view.
- form¶
alias of
CalculationChoiceForm
- get(request: HttpRequest, *args: object, **kwargs: object) HttpResponseRedirect | HttpResponse ¶
Check form view.
- class MathCalculateDemoView(**kwargs)¶
Bases:
View
Math calculation demonstration view.
The user is shown a mathematical expression as a question. The user calculates the mathematical expression. After a timeout, the user is shown the result of the mathematical expression. The user compares his calculation with the result of the mathematical expression displayed on the page.
- get(request: HttpRequest) JsonResponse | HttpResponse ¶
Render the task page and update tasks later on the page.
- class MathCalculateSolutionView(**kwargs)¶
Bases:
TemplateView
Calculate exercise view with input of a solution and scoring.
The
get
method renders the page for the exercise. The page contains a form for entering the user’s solution.On the user side, a post-request is generated via Ajax to receive the task.
The
post
method accepts a user response for validation and returns a JSON response with an evaluate.- get_context_data(**kwargs: object) dict[str, object] ¶
Add form with title to context.
- post(request: HttpRequest) JsonResponse ¶
Accept user’s answer for verification.
- render_task(request: HttpRequest) JsonResponse ¶
Send question text to page.
Gets the task creation conditions from the session. Create new
task
instance, saveanswer_text
in session, render newquestion_text
to user via json response.Parameters¶
- requestHttpRequest
Request to receive new text of the question.
Return¶
- JsonResponse
Json response with new question text.
- class SetMultiplicationTableExerciseView(**kwargs)¶
Bases:
RedirectView
Setup initial data for multiplication table exercises view.
Saves to session the
task_conditions
.Redirect to
MathCalculateSolutionView
.- get(request: HttpRequest, *args: object, **kwargs: object) HttpResponseBase ¶
Save task conditions in session.