Opened 10 years ago
Closed 10 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.
  Note:
 See   TracTickets
 for help on using tickets.
    
The "Invalid 'default'" feature was reverted in #25417.