コード例 #1
0
ファイル: tests.py プロジェクト: Linkid/django-tests-tuto
    def setUp(self):
        ## First poll
        self.first_question = "What is your age?"
        self.first_date = datetime.datetime.now().replace(tzinfo=utc)
        self.first_choice_text = "42"
        self.second_date = datetime.datetime(2014, 1, 11, 0, 1).replace(tzinfo=utc)

        first_poll = Poll()
        first_poll.question = self.first_question
        first_poll.pub_date = self.first_date
        first_poll.save()

        second_poll = Poll()
        second_poll.question = self.first_question
        second_poll.pub_date = self.second_date
        second_poll.save()

        first_choice = Choice()
        first_choice.poll = Poll.objects.all()[0]
        first_choice.choice_text = self.first_choice_text
        first_choice.save()