Opened 6 years ago

Last modified 6 years ago

#30280 closed Bug

Model_get_FIELD_display() returns proxies in 2.2rc1 but always returned strings previously — at Version 2

Reported by: Matthias Kestenholz Owned by: nobody
Component: Database layer (models, ORM) Version: 2.2
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

I'm not sure whether that was wanted but cc79c7ee637e65c8da27e56d746c87903d5ec901 (#27795) introduced a change where code which calls get_*_display got a string previously and now gets a proxy under some circumstances.

If this isn't wanted (and I cannot find anything in the release notes saying that it is) then that's a regression which should be fixed before releasing Django 2.2.

Change History (2)

comment:1 by Matthias Kestenholz, 6 years ago

... thinking about this some more, maybe it makes sense to return lazy strings when using lazy strings inside choices.

If that's the case this would certainly warrant a mention in the release notes (or maybe I haven't found it?)

comment:2 by Tim Graham, 6 years ago

Description: modified (diff)
Summary: _get_FIELD_display returns proxies in 2.2rc1 but always returned strings previouslyModel_get_FIELD_display() returns proxies in 2.2rc1 but always returned strings previously
Triage Stage: UnreviewedAccepted

Probably str() could be used where force_text() was used previously. By the way, you should explain how to reproduce the issue, i.e. what "under some circumstances" means.

Note: See TracTickets for help on using tickets.
Back to Top