Kaydet (Commit) 4fe6824f authored tarafından Claude Paroz's avatar Claude Paroz

Fixed #23679 -- Fixed null introspection for char/text fields

Thanks Paul Dejean for the report.
üst 2118aa8a
......@@ -123,8 +123,7 @@ class Command(BaseCommand):
field_type = 'NullBooleanField('
else:
extra_params['blank'] = True
if field_type not in ('TextField(', 'CharField('):
extra_params['null'] = True
extra_params['null'] = True
field_desc = '%s = %s%s' % (
att_name,
......
......@@ -50,6 +50,7 @@ class ColumnTypes(models.Model):
bool_field = models.BooleanField(default=False)
null_bool_field = models.NullBooleanField()
char_field = models.CharField(max_length=10)
null_char_field = models.CharField(max_length=10, blank=True, null=True)
comma_separated_int_field = models.CommaSeparatedIntegerField(max_length=99)
date_field = models.DateField()
date_time_field = models.DateTimeField()
......
......@@ -51,6 +51,7 @@ class InspectDBTestCase(TestCase):
if (connection.features.can_introspect_max_length and
not connection.features.interprets_empty_strings_as_nulls):
assertFieldType('char_field', "models.CharField(max_length=10)")
assertFieldType('null_char_field', "models.CharField(max_length=10, blank=True, null=True)")
assertFieldType('comma_separated_int_field', "models.CharField(max_length=99)")
assertFieldType('date_field', "models.DateField()")
assertFieldType('date_time_field', "models.DateTimeField()")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment