Replies: 7 comments
-
Is this just a change to If it's the former, I'm not really sure. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
To clarify, does the |
Beta Was this translation helpful? Give feedback.
-
Sorry - |
Beta Was this translation helpful? Give feedback.
-
Okay - that makes sense. A |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I had the same problem and using this factory to solve the problem:
|
Beta Was this translation helpful? Give feedback.
-
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?
Beta Was this translation helpful? Give feedback.
All reactions