We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
django-stubs/django-stubs/contrib/admin/utils.pyi
Line 57 in 9880684
nested
list[Model]
It should return something like list[RecursiveModelList] with RecursiveModelList being:
list[RecursiveModelList]
RecursiveModelList: TypeAlias = Model | list['RecursiveModelList']
You can verify by running the following and checking what's in collected_instances:
collected_instances
class Author(Model): name = CharField(max_length=100) class BooksCollection(Model): name = CharField(max_length=100) author = ForeignKey(Author, on_delete=CASCADE) class Book(Model): name = CharField(max_length=100) collection = ForeignKey(BooksCollection, on_delete=CASCADE) author = Author.objects.create(name="Author") collection = BooksCollection.objects.create(name="Author's life adventures", author=author) book = Book.objects.create(name="Author's childhood", collection=collection) collector = NestedObjects(using="default") collector.collect([author]) collected_instances = collector.nested()
python
django
mypy
django-stubs
django-stubs-ext
The text was updated successfully, but these errors were encountered:
Or list[Any] (if recursion is problematic).
list[Any]
Sorry, something went wrong.
No branches or pull requests
Bug report
What's wrong
django-stubs/django-stubs/contrib/admin/utils.pyi
Line 57 in 9880684
In the code above, the
nested
method returns a simplelist[Model]
, while it is a bit more complex than that.How is that should be
It should return something like
list[RecursiveModelList]
with RecursiveModelList being:How to reproduce
You can verify by running the following and checking what's in
collected_instances
:System information
python
version: 2.11.2django
version: 4.2.10mypy
version: 1.8.0django-stubs
version: 4.2.7django-stubs-ext
version: 4.2.7The text was updated successfully, but these errors were encountered: