-
Notifications
You must be signed in to change notification settings - Fork 770
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
ModelChoiceFilter's queryset kwarg attached to memoized fields - which can cause issues #1525
Comments
@shangxiao Any chance you could open a branch with a failing test case so I can see exactly what you mean? Thanks. |
@carltongibson cheers for responding so quickly 👍 Added a PR with test showing what I meant. |
Honestly I'm not really expecting a fix per se but just wanted to "document" it with an issue so that others may be aware. Perhaps mentioning this in the docs might be worthwhile? |
Thanks @shangxiao. Let me have a think about it, but yes... forcing evaluation of |
One thing we might do here is just deepcopy |
Actually also worth mentioning that introspecting filters like so works fine:
|
Given the following filterset (details omitted for brevity):
If you happen to access
base_filters
at module level and (or anywhere without a request) like so:Then the bar queryset is evaluated and returns an empty queryset. Subsequently when you process the filtering during an actual request the filtered queryset never gets attached to the form field.
The text was updated successfully, but these errors were encountered: