Skip to content

Error while passing gettext_lazy to arguments expecting strings #1137

@hannseman

Description

@hannseman

Bug report

What's wrong

Errors when passing gettext_lazy strings to parameters expecting strings like verbose_name and help_text on model fields:

error: Argument "verbose_name" to "PositiveBigIntegerField" has incompatible type
"_StrPromise"; expected "Optional[str]"  [arg-type]
            null=True, blank=True, verbose_name=_("number")

(where _ is defined as from django.utils.translation import gettext_lazy as _)

This was introduced in #689

How is that should be

_StrPromise should be able to be passed as a str.

System information

  • OS: MacOS 12.4
  • python version: 3.10
  • django version: 4.1
  • mypy version: 0.971
  • django-stubs version: master
  • django-stubs-ext version: master

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions