#25480: CharField + choices + default = fields.E008
----------------------------------------------+--------------------
Reporter: Kondou-ger | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer (models, ORM) | Version: 1.9a1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
Have this as your models.py:
{{{
from django.db import models
from django.utils.translation import ugettext_lazy
breakage_status = (
(ugettext_lazy("In queue"), 'queue'),
(ugettext_lazy("Processing"), 'proces'),
(ugettext_lazy("Done"), 'done'),
)
class Breakage(models.Model):
status = models.CharField(max_length=6, default="queue",
choices=breakage_status)
}}}
Results in:
{{{
(project)kondou:project/ (master✗) $ ./manage.py check
SystemCheckError: System check identified some issues:
ERRORS:
project.Breakage.status: (fields.E008) Invalid 'default' value: Value
'queue' is not a valid choice.
System check identified 1 issue (0 silenced).
}}}
with `default="queue"`
{{{
(project)kondou:project/ (master✗) $ ./manage.py check
SystemCheckError: System check identified some issues:
ERRORS:
project.Breakage.status: (fields.E008) Invalid 'default' value: Value
"(<django.utils.functional.lazy.<locals>.__proxy__ object at
0x7ff17180d358>, 'queue')" is not a valid choice.
System check identified 1 issue (0 silenced).
}}}
with `default=breakage_status[0]`
{{{
(project)kondou:project/ (master✗) $ ./manage.py check
SystemCheckError: System check identified some issues:
ERRORS:
project.Breakage.status: (fields.E008) Invalid 'default' value: Value
'queue' is not a valid choice.
System check identified 1 issue (0 silenced).
}}}
with `default=breakage_status[0][1]`
{{{
(project)kondou:project/ (master✗) $ ./manage.py check
SystemCheckError: System check identified some issues:
ERRORS:
project.Breakage.status: (fields.E008) Invalid 'default' value: Ensure
this value has at most 6 characters (it has 8).
System check identified 1 issue (0 silenced).
}}}
with `default=breakage_status[0][0]`.
--
Ticket URL: <https://code.djangoproject.com/ticket/25480>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.c242bc09fc21c6875bd39362058b66d3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.