# Path: pinax/lms/activities/forms.py
# class SurveyForm(forms.Form):
# 
#     def __init__(self, *args, **kwargs):
# 
#         self.questions = kwargs.pop("questions")
#         super(SurveyForm, self).__init__(*args, **kwargs)
# 
#         for question in self.questions:
#             field_class = question["field_class"]
#             kwargs = {
#                 "label": question["label"],
#             }
# 
#             if question.get("help_text"):
#                 kwargs.update({"help_text": question["help_text"]})
# 
#             if question.get("required") is not None:
#                 kwargs.update({"required": question["required"]})
# 
#             kwargs.update(question.get("extra_args", {}))
#             self.fields[question["name"]] = field_class(**kwargs)
# 
# Path: pinax/lms/activities/signals.py



from django.shortcuts import redirect, render
from .forms import SurveyForm
from .signals import activity_completed
            "answer_template": self.answer_template,
        }
        ctx.update(self.extra_context)
        activity_completed.send(sender=self, activity_key=self.activity_key, activity_session_state=self.session_state, request=request)
        return render(request, self.completed_template_name, ctx)


class MultipleShortAnswerQuiz(Quiz):

    template_name = "pinax/lms/activities/multiple_short_answer_quiz.html"
    completed_template_name = "pinax/lms/activities/multiple_short_answer_quiz_completed.html"
    question_template = "pinax/lms/activities/_question.html"
    answer_template = "pinax/lms/activities/_question.html"

    def get_context_data(self, **kwargs):
        context = super(MultipleShortAnswerQuiz, self).get_context_data(**kwargs)
        data = self.get_data()
        context.update({
            "question_number": data["question_number"] + 1,
            "num_questions": len(data["questions"]),
            "question": data["questions"][data["question_number"]],
            "question_template": self.question_template,
            "answer_template": self.answer_template,
        })
        context.update(self.extra_context)
        return context

    def handle_get_request(self, request):
        data = self.get_data()
        if data is None:

# Path: pinax/lms/activities/forms.py
# class SurveyForm(forms.Form):
# 
#     def __init__(self, *args, **kwargs):
# 
#         self.questions = kwargs.pop("questions")
#         super(SurveyForm, self).__init__(*args, **kwargs)
# 
#         for question in self.questions:
#             field_class = question["field_class"]
#             kwargs = {
#                 "label": question["label"],
#             }
# 
#             if question.get("help_text"):
#                 kwargs.update({"help_text": question["help_text"]})
# 
#             if question.get("required") is not None:
#                 kwargs.update({"required": question["required"]})
# 
#             kwargs.update(question.get("extra_args", {}))
#             self.fields[question["name"]] = field_class(**kwargs)
# 
# Path: pinax/lms/activities/signals.py



# Path: pinax/lms/activities/base.py
from django.shortcuts import redirect, render
from .forms import SurveyForm
from .signals import activity_completed

            "answer_template": self.answer_template,
        }
        ctx.update(self.extra_context)
        activity_completed.send(sender=self, activity_key=self.activity_key, activity_session_state=self.session_state, request=request)
        return render(request, self.completed_template_name, ctx)


class MultipleShortAnswerQuiz(Quiz):

    template_name = "pinax/lms/activities/multiple_short_answer_quiz.html"
    completed_template_name = "pinax/lms/activities/multiple_short_answer_quiz_completed.html"
    question_template = "pinax/lms/activities/_question.html"
    answer_template = "pinax/lms/activities/_question.html"

    def get_context_data(self, **kwargs):
        context = super(MultipleShortAnswerQuiz, self).get_context_data(**kwargs)
        data = self.get_data()
        context.update({
            "question_number": data["question_number"] + 1,
            "num_questions": len(data["questions"]),
            "question": data["questions"][data["question_number"]],
            "question_template": self.question_template,
            "answer_template": self.answer_template,
        })
        context.update(self.extra_context)
        return context

    def handle_get_request(self, request):
        data = self.get_data()
        if data is None:

            self.already_completed_message(request)