Custom filter based on RangeFilter or maybe LookupChoiceFilter

121 views
Skip to first unread message

Ivaylo Tonev

unread,
Mar 5, 2021, 11:15:56 PM3/5/21
to django-filter
Hello,

I am using Django-filters with DRF 3.

I want to create a custom filter so that the user to be able to do such queries:

Closed range [1000, 2000]

?price_from=1000&price_to=2000

Or 

exact value:

?price=200

Could you give some example or direction of how I should do that?


But than the query looks like this:

?price_lookup=exact&price=7800

which is different from what I want.

Kind regards, Ivaylo


Carlton Gibson

unread,
Mar 6, 2021, 12:16:40 AM3/6/21
to django...@googlegroups.com
There’s a whole set of RangeFilters for this purpose. 

Docs are in the filter reference: 


--
You received this message because you are subscribed to the Google Groups "django-filter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-filte...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-filter/35b83821-8f66-4bc9-b7d7-d2d1020fd30bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages