def fill_answers(self): fake = Factory.create() min_number = 10 max_number = 20 questions = Question.objects.all() is_correct = (True, False) counter = 1 for q in questions: for i in range(0, randint(min_number, max_number)): ans = Answer() ans.text = fake.paragraph(nb_sentences=randint(2, 4), variable_nb_sentences=True) ans.author = Profile.objects.first() ans.question = q ans.rating = randint(0, 1500) ans.is_correct = choice(is_correct) ans.id = counter counter += 1 ans.save() self.stdout.write('in question [%d] add ans [%d]' % (q.id, ans.id))