Repository: typeddjango/django-stubs

Issue:
Error while passing gettext_lazy to arguments expecting strings
# Bug report

<!--
Hi, thanks for submitting a bug. We appreciate that.

But, we will need some information about what's wrong to help you.
-->

## What's wrong

Errors when passing `gettext_lazy` strings to parameters expecting strings like `verbose_name` and `help_text` on model fields:

```python
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 https://github.com/typeddjango/django-stubs/pull/689 
## How is that should be

<!-- Describe how it should work. -->

`_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

Error while passing gettext_lazy to arguments expecting strings
# Bug report

<!--
Hi, thanks for submitting a bug. We appreciate that.

But, we will need some information about what's wrong to help you.
-->

## What's wrong

Errors when passing `gettext_lazy` strings to parameters expecting strings like `verbose_name` and `help_text` on model fields:

```python
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 https://github.com/typeddjango/django-stubs/pull/689 
## How is that should be

<!-- Describe how it should work. -->

`_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



Discussion:

Resolving patch:
diff --git a/django_stubs_ext/django_stubs_ext/__init__.py b/django_stubs_ext/django_stubs_ext/__init__.py
--- a/django_stubs_ext/django_stubs_ext/__init__.py
+++ b/django_stubs_ext/django_stubs_ext/__init__.py
@@ -1,7 +1,16 @@
+from .aliases import StrOrPromise, StrPromise
 from .aliases import ValuesQuerySet as ValuesQuerySet
 from .annotations import Annotations as Annotations
 from .annotations import WithAnnotations as WithAnnotations
 from .patch import monkeypatch as monkeypatch
 from .types import AnyAttrAllowed as AnyAttrAllowed
 
-__all__ = ["monkeypatch", "ValuesQuerySet", "WithAnnotations", "Annotations", "AnyAttrAllowed"]
+__all__ = [
+    "monkeypatch",
+    "ValuesQuerySet",
+    "WithAnnotations",
+    "Annotations",
+    "AnyAttrAllowed",
+    "StrPromise",
+    "StrOrPromise",
+]
diff --git a/django_stubs_ext/django_stubs_ext/aliases.py b/django_stubs_ext/django_stubs_ext/aliases.py
--- a/django_stubs_ext/django_stubs_ext/aliases.py
+++ b/django_stubs_ext/django_stubs_ext/aliases.py
@@ -2,9 +2,15 @@
 
 if typing.TYPE_CHECKING:
     from django.db.models.query import _T, _QuerySet, _Row
+    from django.utils.functional import _StrOrPromise as StrOrPromise
+    from django.utils.functional import _StrPromise as StrPromise
 
     ValuesQuerySet = _QuerySet[_T, _Row]
 else:
     from django.db.models.query import QuerySet
+    from django.utils.functional import Promise as StrPromise
 
     ValuesQuerySet = QuerySet
+    StrOrPromise = typing.Union[str, StrPromise]
+
+__all__ = ["StrOrPromise", "StrPromise", "ValuesQuerySet"]


Test patch: