diff --git a/django_quanttide/models/__init__.py b/django_quanttide/models/__init__.py index ac96a7a..37545c7 100644 --- a/django_quanttide/models/__init__.py +++ b/django_quanttide/models/__init__.py @@ -5,7 +5,7 @@ from .choices import StageChoices from .fields import ( IDField, NumberField, NameField, - VerboseNameField, TitleField, DescriptionField, + VerboseNameField, TitleField, DescriptionField, ReadmeField, TypeField, StatusField, StageField, CreatedAtField, UpdatedAtField, CreatedByField, UpdatedByField, @@ -20,6 +20,7 @@ 'VerboseNameField', 'TitleField', 'DescriptionField', + 'ReadmeField', 'TypeField', 'StatusField', 'StageField', diff --git a/tests/test_models_fields.py b/tests/test_models_fields.py index 1cb2655..865a501 100644 --- a/tests/test_models_fields.py +++ b/tests/test_models_fields.py @@ -5,7 +5,7 @@ from django_quanttide.models import ( IDField, NumberField, NameField, - VerboseNameField, TitleField, DescriptionField, + VerboseNameField, TitleField, DescriptionField, ReadmeField, TypeField, StatusField, StageField, StageChoices, CreatedAtField, UpdatedAtField, CreatedByField, UpdatedByField, @@ -112,6 +112,24 @@ def test_custom_options(self): self.assertEqual(field.verbose_name, '关联描述') +class ReadmeFieldTestCase(SimpleTestCase): + + def test_defaults(self): + field = ReadmeField() + self.assertEqual(field.default, None) + self.assertTrue(field.blank) + self.assertTrue(field.null) + self.assertEqual(field.verbose_name, '简介') + + def test_custom_options(self): + field = ReadmeField(default='test', blank=False, null=False, verbose_name='关联简介') + self.assertEqual(field.default, 'test') + self.assertFalse(field.blank) + self.assertFalse(field.null) + self.assertEqual(field.verbose_name, '关联简介') + + + class TypeFieldTestCase(SimpleTestCase): def test_defaults(self):