Пример #1
0
    def handle_noargs(self, **options):
        try:
            survey = Survey(**self.survey_instance)
            survey.save()
            image = SurveyImage(survey=survey, **self.image)
            image.save()
            q = {}
            for i in range(3):
                q[i] = Question(survey=survey, **self.questions[i])
                q[i].save()

            self.stdout.write(
                "Successfully created case study survey: %s" % survey.slug
            )

        except IntegrityError:
            err = sys.exc_info()[0]
            self.stdout.write(
                "FAILED to create case study survey: %s" % err
            )
Пример #2
0
    def handle_noargs(self, *args, **options):
        try:
            survey = Survey(**self.survey_instance)
            survey.save()
            q = {}
            c = {}
            for i in range(40):
                q[i] = Question(survey=survey, **self.questions[i])
                q[i].save()
                for j in range(5):
                    c[j] = Choice(question=q[i], **self.choices[j])
                    c[j].save()

            self.stdout.write(
                "Successfully created pds survey: %s" % survey.slug
            )
        except IntegrityError:
            err = sys.exc_info()[0]
            self.stdout.write(
                "FAILED to create pds survey: %s" % err
            )