Skip to content
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

Document multiparameter patern. #1020

Open
carltongibson opened this issue Dec 17, 2018 · 3 comments
Open

Document multiparameter patern. #1020

carltongibson opened this issue Dec 17, 2018 · 3 comments

Comments

@carltongibson
Copy link
Owner

You need to filter on more that one parameter? Use a multi-widget to have all values passes as one to a single filter.

  • Document this with an example.
  • Does it merit a helper class?

c.f. #977 (comment)

@rpkilby
Copy link
Collaborator

rpkilby commented Feb 19, 2019

Note that this isn't fully compatible with API use. e.g., take the range* multi filters. The actual query params have after and before suffixes, however validation errors are raised under the unsuffixed filter name. There is no way to distinguish which sub-param the error applied to.

The multi-widget incompatibility should also be documented in the DRF integration section.

@carltongibson
Copy link
Owner Author

carltongibson commented Nov 21, 2024

Filtering is done as per the Spanning multi-valued relationships Django docs. If you need to filter two parameters in a single call to filter(), you need to be creating a (multi-)filter that takes the (e.g. two) parameters and applies them in a single step.

There's an example for this pattern here: https://gitlab.com/-/snippets/2237049

@carltongibson
Copy link
Owner Author

Different example in #1672 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants