Skip to content

How to do filter or search on JSONField()? #1164

Answered by zbyte64
elcolie asked this question in Q&A
Discussion options

You must be logged in to vote

Relevant django-filter issues: carltongibson/django-filter#583 carltongibson/django-filter#426

You can do this by manually defining your own filter, example from the first issue:

MarkaMoto = django_filters.CharFilter(name='attributes', lookup_expr='MarkaMoto__value__contains')

But there are limitations like not supporting icontains or querying arrays.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by zbyte64
Comment options

You must be logged in to vote
1 reply
@zbyte64
Comment options

zbyte64 Apr 14, 2021
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #697 on April 14, 2021 20:05.