how to filter if filter as OR across two or more fields for same model?
See original GitHub issueLet’s say I want to run a filter like this
User.objects.filter(Q(username="admin") | Q(first_name="test"))
I understand drest does not support this in the end point.
How can I modify so as to allow something like this in the endpoint? I am okay to make a PR for this. I just want to get some guidance so I can conform to drest architecture
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Filter by using advanced criteria - Microsoft Support
If the data you want to filter requires complex criteria (such as Type = "Produce" OR Salesperson = "Davolio"), you can use the...
Read more >Excel FILTER function with formula examples - Ablebits
Tip. To filter duplicates based on the values in the key columns, include only those specific columns in the COUNTIFS function.
Read more >How to apply multiple filtering criteria by combining AND and ...
Choose a built-in filter. Enter the benchmark amount. As you can see in Figure D, James has only one commission that falls below...
Read more >How to filter multiple values in only one column in Excel?
Select Filter the list, in-place option from the Action section; (2.) Then, select the data range that you want to filter in the...
Read more >How do I apply one filter to multiple fields? - Looker Community
Say you want to have a single filter apply to two separate fields (fields A and B). The end goal is to be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is tricky to do at the framework level, since we’ll need to update the query syntax to include grouping (e.g. to support queries like
(A | B) & C
). My suggestion is to overrideViewSet.filter_queryset()
and use custom query params:@ryochiji Do you know if dynamic-rest will work with django-filters to solve this issue? I haven’t been able to get them to play nicely together