#30931: Cannot override get_FOO_display() in Django 2.2+.
-------------------------------------+-------------------------------------
Reporter: Jim Ouwerkerk | Owner: Carlton
Type: | Gibson
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sergey Fedoseev):
Replying to [comment:9 Carlton Gibson]:
> Hi Sergey,
>
> No. That's exactly the "implementing that just reverses the pass/fail
behaviour depending on order..." — two test cases, one with the override
declared before the field, one after, the one fails as it is, the other
fails if you put that guard in... — That's on 2.1, but it's the underlying
issue being exposed: the right approach is overriding
`_get_FIELD_display()`. (Rather than us trying to patch something into
`Field...`.)
>
> [https://github.com/django/django/pull/11999 PR]
>
>
>
[https://github.com/sir-
sigurd/django/commit/2dd6421ff0c29b19f8755e2d5638fc913224bf87 Both tests]
pass for me ¯\_(ツ)_/¯.
--
Ticket URL: <https://code.djangoproject.com/ticket/30931#comment:11>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.61bcddb814f90908d152c8327f083fa4%40djangoproject.com.