Opened 9 years ago

Closed 9 years ago

#25628 closed Bug (fixed)

SystemCheckError states "Invalid 'default' value" when no max_length on CharField is specified.

Reported by: zelo Owned by: nobody
Component: Database layer (models, ORM) Version: 1.9b1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using django 1.9b1 i got this message during execution of makemigrations command:

SystemCheckError: System check identified some issues:

ERRORS:
resources.Resource.test: (fields.E008) Invalid 'default' value: Ensure this value has at most %(limit_value)d characters (it has %(show_value)d).
resources.Resource.test: (fields.E120) CharFields must define a 'max_length' attribute.

With this code:

    test = models.CharField(
        choices=(
            ('foo','bar'),
        ),
        default='foo',
    )

Adding max_length resolves both errors.

Change History (1)

comment:1 by Tim Graham, 9 years ago

Resolution: fixed
Status: newclosed

The "Invalid 'default'" feature was reverted in #25417.

Note: See TracTickets for help on using tickets.
Back to Top