# Typing get\_foo\_display

**URL:** <https://forum.djangoproject.com/t/typing-get-foo-display/38346>\
**Category:** Using Django\
**Created:** [January 29, 2025, 9:30am UTC](https://forum.djangoproject.com/t/typing-get-foo-display/38346 "2025-01-29T09:30:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![strokirk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/strokirk/32/3414_2.png) [@strokirk](https://forum.djangoproject.com/u/strokirk)\
**Post date:** [January 29, 2025, 9:30am UTC](https://forum.djangoproject.com/t/typing-get-foo-display/38346/1 "2025-01-29T09:30:54Z")

</div>

In VS Code, I’m using `pylance` due to it’s speed, even though it’s less correct than `mypy` with the `django-stubs` plugin. Unfortunately, one of it’s quirks is that it thinks all `get_foo_display` usages are unknown attribute accesses and flags them for errors.

Does anyone know a way to avoid these errors for pylance, or maybe an easy way to replicate the `instance.get_foo_display()` behaviour in a helper function? I’m thinking some function like `get_display(instance, 'foo')` could be used (even though that would lose mypy coveage).
