Over-specific return type required for ListView.get_queryset
overrides
#477
Labels
bug
Something isn't working
ListView.get_queryset
overrides
#477
Bug report
What's wrong
Right now
django-stubs
requires that the return type of aviews.generic.ListView
subclass'get_queryset
method be a queryset, which seems reasonable. However,django
doesn't actually require that, and this bit me while adding typing to a project that uses a non-queryset iterable in a view.See here:
https://github.com/django/django/blob/f87b0ecd37e64e7a019d472de37d0789a8790f1f/django/views/generic/list.py#L21
V.s. here:
django-stubs/django-stubs/views/generic/list.pyi
Line 20 in a8fdd4c
Repro case:
Message:
This issue might also affect other view methods -- for example it seems
DetailView
also is required to require aQuerySet
right now:django-stubs/django-stubs/views/generic/detail.pyi
Line 17 in a8fdd4c
System information
159249712920.04~9a1ea2e-Ubuntu SMP Fri Jun 19 22:43:37 UTC x86_64 x86_64 x86_64 GNU/Linuxpython
version: 3.8.2django
version: 3.1.2mypy
version: 0.782django-stubs
version: 1.6.0I can submit a pull for this if there's interest.
The text was updated successfully, but these errors were encountered: