-
Notifications
You must be signed in to change notification settings - Fork 760
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Upgrade to 2.0 - weird ForeignKey filtering issue #1139
Comments
Is this just a change to If it's the former, I'm not really sure. |
Thanks @rpkilby , ill review what you posted. I actually dug up this issue #84 and we have the reverse problem - we have an error being thrown if nothing exists. I switched this to a numberfilter (overriding the ForeignKey default for the ChoiceFilter) and it worked. Will have to see what works best here. |
To clarify, does the |
Sorry - |
Okay - that makes sense. A |
ModelChoiceFilter in django-filter 0.13.0 returns empty list if PK value doesn't exist in the database. Now we get either validation error or the filter returns everything as if the PK value wasn't specified. |
I had the same problem and using this factory to solve the problem:
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hey there,
I am upgrading to Django 2 and using
django-filter==2.2.0
after upgrading from1.1.0
I have the following model:
with the following filter:
This table is queried frequently for
?company_id=FOO
, and in the previous version, if FOO did not exist, Django would return emptyresults
array.With the new upgrade, Im getting tests failing on querying for
company_id
that doesnt exist. Specifically, Im getting a ChoiceField error when someone queries this table with acompany_id
that does not exist:{'company_id': ['Select a valid choice. That choice is not one of the available choices.']}
And im getting similar errors on filters for ForeignKeys that dont exist. Is this new behavior, or am I upgrading incorrectly?
The text was updated successfully, but these errors were encountered: