Beispiel #1
0
 def test_model_field_formfield_size(self):
     model_field = ArrayField(models.CharField(max_length=27), size=4)
     form_field = model_field.formfield()
     self.assertIsInstance(form_field, SimpleArrayField)
     self.assertEqual(form_field.max_length, 4)
Beispiel #2
0
 def test_model_field_choices(self):
     model_field = ArrayField(models.IntegerField(choices=((1, 'A'), (2, 'B'))))
     form_field = model_field.formfield()
     self.assertEqual(form_field.clean('1,2'), [1, 2])
Beispiel #3
0
 def test_model_field_formfield(self):
     model_field = ArrayField(models.CharField(max_length=27))
     form_field = model_field.formfield()
     self.assertIsInstance(form_field, SimpleArrayField)
     self.assertIsInstance(form_field.base_field, forms.CharField)
     self.assertEqual(form_field.base_field.max_length, 27)
Beispiel #4
0
 def test_model_field_formfield_size(self):
     model_field = ArrayField(models.CharField(max_length=27), size=4)
     form_field = model_field.formfield()
     self.assertIsInstance(form_field, SimpleArrayField)
     self.assertEqual(form_field.max_length, 4)
Beispiel #5
0
 def test_model_field_formfield(self):
     model_field = ArrayField(models.CharField(max_length=27))
     form_field = model_field.formfield()
     self.assertIsInstance(form_field, SimpleArrayField)
     self.assertIsInstance(form_field.base_field, forms.CharField)
     self.assertEqual(form_field.base_field.max_length, 27)
Beispiel #6
0
 def test_model_field_choices(self):
     model_field = ArrayField(
         models.IntegerField(choices=((1, 'A'), (2, 'B'))))
     form_field = model_field.formfield()
     self.assertEqual(form_field.clean('1,2'), [1, 2])
Beispiel #7
0
 def test_model_field_choices(self):
     model_field = ArrayField(models.IntegerField(choices=((1, "A"), (2, "B"))))
     form_field = model_field.formfield()
     self.assertEqual(form_field.clean("1,2"), [1, 2])