Opened 15 years ago
Closed 15 years ago
#12331 closed (worksforme)
get_display shows choices key, not value if field name contains underscore symbol
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | choices, get_display | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
CURRENCY_CHOICES = ( (u"USD", u"$"), (u"EUR", u"€"), ) buyer_currency = models.CharField(u"Price", choices = CURRENCY_CHOICES, max_length=3, default='USD') template: {{user.userprofile.get_buyer_currency_display|safe}} shows "USD" after rebuilding model with no underscore it works as it should: {{user.userprofile.get_buyercurrency_display|safe}} shows "$"
Note:
See TracTickets
for help on using tickets.
I cannot recreate this. Using this model:
specified as AUTH_PROFILE_MODULE in settings.py, with a view that passes a RequestContext to a template that includes:
The displayed page when logged in with a user that has a profile shows: