class ParametersModel(models.Model): ice_cream_is_yummy = LikertField() # cabbage_is_yummy = LikertField(max_value=4) item = LikertField('ice cream beats cabbage') # seven = LikertField('seven is my lucky number', max_value=7) # ten = LikertField('ten is the best', max_value=10) questions_should_not_be_optional = LikertField(blank=False)
class SurveyModel(models.Model): q1 = LikertField('음악들이 내가 입력한 주제와 잘 부합하였다.', blank=False) q2 = LikertField('음악들의 주제가 서로 일관성이 있었다.', blank=False) q3 = LikertField('음악들이 나의 니즈를 잘 반영하였다.', blank=False) q4 = LikertField('이번에 새롭에 듣게 된 음악들이 있었다.', blank=False) q5 = LikertField('이 웹사이트를 주변 사람들에게 추천하겠다.', blank=False) user = models.CharField(max_length=20) created_date = models.DateTimeField(default=timezone.now) user_input = models.CharField(max_length=200) user_output = models.CharField(max_length=200)
class MuffinModel(models.Model): fudge_is_yummy = LikertField() # item = LikertField('fudge beats everything') # Parameters tests #too_many_questions = LikertField(null=True, blank=True) too_many_questions = LikertField(null=False, blank=False, default=3) #too_few_questions = LikertField(null=True) too_few_questions = LikertField(null=False, default=3) #questions_should_not_be_optional = LikertField(blank=True) questions_should_not_be_optional = LikertField(blank=False)
class Feedback(BaseModel): klimatik = models.ForeignKey(Klimatik, on_delete=models.CASCADE, verbose_name=_("Климатик"), related_name='feedbacks') person_name = models.CharField(max_length=255, verbose_name=_("Име")) feedback_text = models.TextField(verbose_name=_("Текст")) feedback_rating = LikertField(verbose_name=_("Оценка")) class Meta: verbose_name = _("отзив") verbose_name_plural = _("отзиви")
def test_null_settable(self): item = LikertField(null=False) self.assertFalse(item.null)
class SurveyModel(models.Model): # q1 = models.CharField(max_length=5, blank=True) # q2 = models.CharField(max_length=5, blank=True) # q3 = models.CharField(max_length=5, blank=True) q1_1_0 = LikertField(blank=False) q2_1_1 = models.CharField(max_length=5, blank=True) q2_1_2 = models.CharField(max_length=5, blank=True) q2_1_3 = models.CharField(max_length=5, blank=True) # q2_1_4 = models.CharField(max_length=5, blank=True) # q2_1_5 = models.CharField(max_length=5, blank=True) q3_1_1 = models.CharField(max_length=5, blank=True) q3_1_2 = models.CharField(max_length=5, blank=True) q3_1_3 = models.CharField(max_length=5, blank=True) # q3_1_4 = models.CharField(max_length=5, blank=True) # q3_1_5 = models.CharField(max_length=5, blank=True) ### q1_2_0 = LikertField(blank=False) q2_2_1 = models.CharField(max_length=5, blank=True) q2_2_2 = models.CharField(max_length=5, blank=True) q2_2_3 = models.CharField(max_length=5, blank=True) # q2_2_4 = models.CharField(max_length=5, blank=True) # q2_2_5 = models.CharField(max_length=5, blank=True) q3_2_1 = models.CharField(max_length=5, blank=True) q3_2_2 = models.CharField(max_length=5, blank=True) q3_2_3 = models.CharField(max_length=5, blank=True) # q3_2_4 = models.CharField(max_length=5, blank=True) # q3_2_5 = models.CharField(max_length=5, blank=True) ### q1_3_0 = LikertField(blank=False) q2_3_1 = models.CharField(max_length=5, blank=True) q2_3_2 = models.CharField(max_length=5, blank=True) q2_3_3 = models.CharField(max_length=5, blank=True) # q2_3_4 = models.CharField(max_length=5, blank=True) # q2_3_5 = models.CharField(max_length=5, blank=True) q3_3_1 = models.CharField(max_length=5, blank=True) q3_3_2 = models.CharField(max_length=5, blank=True) q3_3_3 = models.CharField(max_length=5, blank=True) # q3_3_4 = models.CharField(max_length=5, blank=True) # q3_3_5 = models.CharField(max_length=5, blank=True) ### q1_4_0 = LikertField(blank=False) q2_4_1 = models.CharField(max_length=5, blank=True) q2_4_2 = models.CharField(max_length=5, blank=True) q2_4_3 = models.CharField(max_length=5, blank=True) # q2_4_4 = models.CharField(max_length=5, blank=True) # q2_4_5 = models.CharField(max_length=5, blank=True) q3_4_1 = models.CharField(max_length=5, blank=True) q3_4_2 = models.CharField(max_length=5, blank=True) q3_4_3 = models.CharField(max_length=5, blank=True) # q3_4_4 = models.CharField(max_length=5, blank=True) # q3_4_5 = models.CharField(max_length=5, blank=True) ### q1_5_0 = LikertField(blank=False) q2_5_1 = models.CharField(max_length=5, blank=True) q2_5_2 = models.CharField(max_length=5, blank=True) q2_5_3 = models.CharField(max_length=5, blank=True) # q2_5_4 = models.CharField(max_length=5, blank=True) # q2_5_5 = models.CharField(max_length=5, blank=True) q3_5_1 = models.CharField(max_length=5, blank=True) q3_5_2 = models.CharField(max_length=5, blank=True) q3_5_3 = models.CharField(max_length=5, blank=True) # q3_5_4 = models.CharField(max_length=5, blank=True) # q3_5_5 = models.CharField(max_length=5, blank=True) ### q1_6_0 = LikertField(blank=False) q2_6_1 = models.CharField(max_length=5, blank=True) q2_6_2 = models.CharField(max_length=5, blank=True) q2_6_3 = models.CharField(max_length=5, blank=True) # q2_6_4 = models.CharField(max_length=5, blank=True) # q2_6_5 = models.CharField(max_length=5, blank=True) q3_6_1 = models.CharField(max_length=5, blank=True) q3_6_2 = models.CharField(max_length=5, blank=True) q3_6_3 = models.CharField(max_length=5, blank=True) # q3_6_4 = models.CharField(max_length=5, blank=True) # q3_6_5 = models.CharField(max_length=5, blank=True) # q1_1 = models.CharField(max_length=5, blank=False) # q1_1 = models.CharField(max_length=5, blank=False) # q1_1 = models.CharField(max_length=5, blank=False) ## likert # q1_1 = LikertField(blank=False) # # q2_1 = LikertField(blank=False) # q1_2 = LikertField(blank=False) # # q2_2 = LikertField(blank=False) # q1_3 = LikertField(blank=False) # # q2_3 = LikertField(blank=False) # q1_4 = LikertField(blank=False) # # q2_4 = LikertField(blank=False) # q1_5 = LikertField(blank=False) # # q2_5 = LikertField(blank=False) # q1_6 = LikertField(blank=False) # # q2_6 = LikertField(blank=False) # q1_7 = LikertField(blank=False) # # q2_7 = LikertField(blank=False) # q1_8 = LikertField(blank=False) # # q2_8 = LikertField(blank=False) # q1_9 = LikertField(blank=False) # q2_9 = LikertField(blank=False) # q1_10 = LikertField(blank=False) # q2_10 = LikertField(blank=False) user = models.CharField(max_length=100) user_ip = models.CharField(max_length=20) created_date = models.DateTimeField(default=timezone.now) user_input = models.CharField(max_length=200) user_output = models.CharField(max_length=200)
def test_get_prep_value_null(self): item = LikertField() self.assertTrue(item.get_prep_value(None) is None)
def test_formfield(self): item = LikertField() ff = item.formfield() self.assertEqual(ff.min_value, 0) self.assertIsInstance(ff, forms.LikertFormField)
def test_blank_settable(self): item = LikertField(blank=False) self.assertFalse(item.blank)
def test_get_prep_value_empty_string(self): item = LikertField() self.assertTrue(item.get_prep_value('') is None)
def test_null_set(self): """Unanswered questions are saved as NULL""" item = LikertField() self.assertTrue(item.null)
def test_get_prep_value_strings(self): item = LikertField() for value in xrange(1, 50+1): self.assertIsInstance(item.get_prep_value(str(value)), int)
def test_get_prep_value_negative_int(self): item = LikertField() self.assertIsInstance(item.get_prep_value(-1), int) self.assertEqual(item.get_prep_value(-1), 0)
def test_get_prep_value_strings(self): item = LikertField() for value in xrange(1, 50 + 1): self.assertIsInstance(item.get_prep_value(str(value)), int)
class LikertModel(models.Model): test_is_the_best = LikertField()
def test_instantiation(self): item = LikertField() self.assertIsInstance(item, Field)
def test_blank_set(self): """By default, responses are not required""" item = LikertField() self.assertTrue(item.blank)