#22537: Misleading documentation on choices for a model field
-------------------------------+--------------------
Reporter: carbonXT | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------
The [https://docs.djangoproject.com/en/dev/ref/models/fields/#choices docs
on the choices attribute for a model field] currently read "The first
element in each tuple is the actual value to be stored..."
This is all true and good for simple model fields, but for more complex
ones where the python representation of the field value differs from that
in the database, this is at best misleading. An example of this is the
[https://docs.djangoproject.com/en/dev/howto/custom-model-
fields/#writing-a-field-subclass 'hand' example of field subclassing] in
the docs. For fields like this one, the first element of the model choices
field is the python representation of the field value, not the actual
value to be stored in the database.
I've implemented a [https://github.com/django/django/pull/2539/files pull
request] that implements a minor documentation change clarifying this, and
adds a test to the field subclassing to ensure this behavior is the
blessed behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/22537>
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/051.768fd58f4f203a9580eb566f2cde1624%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.