#20749: get_FOO_display does not return proper value or warn for inconsistent type -------------------------------------+------------------------------------- Reporter: ellisd23@… | Owner: ellisd23 Type: Bug | Status: assigned Component: Database layer | Version: master (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 1 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+------------------------------------- Changes (by ptone):
* needs_better_patch: 0 => 1 * version: 1.5 => master Comment: The current patch will not suffice, as it only addresses Char and Integer fields, but choices can be applied to more Field types than that. between options 1 or 2, I'd lean slightly to 2, as it is a more straightforward implementation. The question is whether there are enough valid cases where you want to call get_FIELD_display on a model where you know the value is not a key in your choices, and getting a bunch of warning noise would be annoying. I think that is a pretty small set of cases, and has to be weighed against keeping the status quo which can result in a pretty confusing problem as it doesn't include any immediate hint as to why you are getting the label back. If the implementation proves to not be practical, a warning in the docs should be clarify what happens when you ask for a label for a mismatched type between choices-key/field. -- Ticket URL: <https://code.djangoproject.com/ticket/20749#comment:6> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/076.7c9009224eebb087418b2c7cb514f23f%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.