示例#1
0
    def post(self, request, quiz_id, round_id):
        '''
        Delete a round
        Attributes:
            PARAMS:
                - quiz_id, round_id
        '''
        round_wrapper = get_round_or_404(request.user, quiz_id, round_id)

        round_wrapper.delete()

        return redirect('quiz:edit-quiz', quiz_id=quiz_id)
示例#2
0
 def post(self, request, quiz_id, round_id):
     '''
     Edit the attributes of the round model
     Attributes:
         PARAMS:
             - quiz_id, round_id
         POST:
             - round_info
     '''
     quiz_wrapper = get_quiz_or_404(request.user, quiz_id)
     round_wrapper = get_round_or_404(quiz_wrapper.quiz, round_id)
     round_info = filter_round_info(request.POST)
     round_wrapper.edit(round_id, round_info)
     return redirect('quiz:edit-round', quiz_id=quiz_id, round_id=round_id)
示例#3
0
    def get(self, request, quiz_id, round_id):
        '''
        Render the form to edit a round
        Attributes:
            None
        '''
        quiz_wrapper = get_quiz_or_404(request.user, quiz_id)
        round_wrapper = get_round_or_404(quiz_wrapper.quiz, round_id)

        context = {
            'quiz': quiz_wrapper.edit_info(),
            'round': round_wrapper.edit_info(),
            'question_types': dict(QuestionType.choices)
        }
        return render(request, 'quiz/create/round.html', context)