-
-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
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
Formset get_queryset() returns QuerySet #2174
Formset get_queryset() returns QuerySet #2174
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically you can return other data types from get_queryset
, see https://github.com/django/django/blob/main/django/forms/models.py
How can we solve this differently?
Thanks @sobolevn. You're right, |
That's surprising. What exactly is this link pointing to? I just found one |
I think it's totally fine to have the method named And if there's any user(s) that override the method to change the return type to e.g. But if I'm using the default implementation of |
This is also fine 👍 |
If I've followed the thumbsup's correctly, the preferred solution is |
Yes, I think |
You're right in that the preferred solution is |
Sorry for the delay, I've reverted the 2nd commit. |
Thank you |
I have made things!
Set the return type of BaseModelFormset.get_queryset() to
QuerySet[_M]
.In previous version, it has a return type of
_IndexableCollection
butQuerySet
is no longer a type ofCollection
(#2095) and in Django main branch, 5.0 and 4.2 this function returns a plain oldQuerySet
.