#24888: A charfield with options shows with short tags in stead of verbose name
in
a modelform
-------------------------------+--------------------
Reporter: wimfeijen | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Suppose you have a charfield in your model which has several choices
defined. When you create a form from this model, the form shows the short
tags as options (which are used for database storage) in stead of the
verbose name (get_xxx_display) which should be used by default for
displaying, in my opinion.
Example:
{{{
FURNISHING = (
("yes", _("Furnished")),
("no", _("Unfurnished")),
("bare", _("Bare")),
)
class Room(TimeStamped):
...
furnishing = models.CharField(verbose_name=_("furnishing"),
max_length=10, choices=FURNISHING, default='no')
...
FIELDS = [..., 'furnishing', ...]
class RoomForm(forms.ModelForm):
class Meta:
model = Room
fields = FIELDS
widgets = {
'furnishing': forms.RadioSelect(),
}
}}}
(A workaround is to use the verbose names as char tags in the database.
However, this does not work in a multilingual environment.)
--
Ticket URL: <https://code.djangoproject.com/ticket/24888>
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/052.03de8f297ed9619f23ef0e355ed9a593%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.