Conceptual question: Does it make any sense to add a filter without a backing form field? #1583
Unanswered
is-pdoherty
asked this question in
Q&A
Replies: 1 comment
-
The form field (plus its widget)) maps from the query string to the values passed to the filter. So in your case you want multiple values passed: The query string for that would either be The form field's job, really, is to exclude bad data, such as passing totally the wrong type:
So even in a GraphQL case, you're still going to want to use one. (I'd never pass raw input from the request straight to my backend. The ORM &co are good at avoiding injection but basic sanitation is still required.) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd mentioned this in #1418 but I figured this question is more broadly applicable and I didn't want to hijack that thread.
What I'm wondering is:
I'm looking to create a custom filter for Django PG Vector columns. My use case is somewhat complicated because it involves PG Vector and Graphene but, distilled, I think it would be being able to translate:
Item.objects.order_by(L2Distance('embedding', [3, 1, 2]))[:5]
into something like:
ItemFilter(lookup_expr="order_by_l2_distance: [3, 1, 2]")
in order to use it in graphql like:
Beta Was this translation helpful? Give feedback.
All reactions