mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-14 07:47:09 +08:00
Rename ValuesQuerySet -> _ValuesQuerySet and remove _BaseQuerySet. Ma… (#654)
* Rename ValuesQuerySet -> _ValuesQuerySet and remove _BaseQuerySet. Make a public alias called ValuesQuerySet in django_stubs_ext. * Update tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from .aliases import ValuesQuerySet as ValuesQuerySet
|
||||
from .patch import monkeypatch as monkeypatch
|
||||
|
||||
__all__ = ["monkeypatch"]
|
||||
__all__ = ["monkeypatch", "ValuesQuerySet"]
|
||||
|
||||
8
django_stubs_ext/django_stubs_ext/aliases.py
Normal file
8
django_stubs_ext/django_stubs_ext/aliases.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import typing
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from django.db.models.query import _T, _Row, _ValuesQuerySet
|
||||
|
||||
ValuesQuerySet = _ValuesQuerySet[_T, _Row]
|
||||
else:
|
||||
ValuesQuerySet = typing.Any
|
||||
16
django_stubs_ext/tests/typecheck/test_aliases.yml
Normal file
16
django_stubs_ext/tests/typecheck/test_aliases.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
- case: alias_values_query_set
|
||||
main: |
|
||||
from django_stubs_ext import ValuesQuerySet
|
||||
from myapp.models import Blog
|
||||
|
||||
a: ValuesQuerySet[Blog, Blog]
|
||||
installed_apps:
|
||||
- myapp
|
||||
files:
|
||||
- path: myapp/__init__.py
|
||||
- path: myapp/models.py
|
||||
content: |
|
||||
from django.db import models
|
||||
|
||||
class Blog(models.Model):
|
||||
created_at = models.DateTimeField()
|
||||
Reference in New Issue
Block a user