-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypedModel instance missing get_type_display
method
#47
Comments
The ticket was accepted, and a PR exists for it. |
Hmm, I guess though if you wanted it to work in older Django versions you'd still need to make |
Tempted to just not fix it here rather than hack the choices, since that probably has other consequences. What are you using |
Rendering the human-readable choice. It's a really nice method. If you don't want to hack the choices (which I don't blame you). Consider adding |
Cool, that's a reasonable thing to do. I'll hold off till the Django ticket is addressed so I can guard the method addition on a particular django version (presumably 2.2, but maybe they'll backport it) |
Since choices doesn't have a truthy value,
django.db.models.fields.Field
doesn't add theget_FOO_display
(code, docs) which in this case would beget_type_display
.IMO this is a Django bug (I'll file a ticket shortly), however opening an issue here for transparency and tracking (if they reject the ticket).
FYI django_model_utils works around this by adding dummy choices: https://github.com/jazzband/django-model-utils/blob/master/model_utils/fields.py#L75
So there is a (disappointing) workaround
The text was updated successfully, but these errors were encountered: