Filtersets

17 views
Skip to first unread message

Conrad Rowlands

unread,
Apr 1, 2014, 7:16:05 AM4/1/14
to django...@googlegroups.com
Hi All. I wonder if anyone can point me in the right direction. I am building a web api using django and FilterSets and wish to allow consumers to perform a query along the lines of

Manufacturer =x OR manufacturer = y etc etc

Is this achievable out of the box and how would you specify this within the url? My current url looks like this

http://127.0.0.1:8000/compare/api/instance/?Manufacturer=x&Manufacturer=y

but this only performs an AND on the underlying data

Manufacturer =x AND manufacturer = y etc etc

Also, please note that whilst I would like to perform an OR with regard to the manufacturer if I include other fields to be queried I would expect these to be AND'd for example

http://127.0.0.1:8000/compare/api/instance/?Manufacturer=x&Manufacturer=yModel=z

should equate to

(Manufacturer =x OR manufacturer = y) AND Model = z

Thanks In advance

C. Kirby

unread,
Apr 1, 2014, 11:35:23 AM4/1/14
to django...@googlegroups.com
Hi Conrad,
I've built a django app to build queries like this. The one that is available on github right now is somewhat specific to my initial use case, but I plan on releasing a new, much more modular version of it this week. If you want to take a look at it and use it, or wait for the update, or just take ideas from it, here it is:

https://github.com/ckirby/django-modelqueryform

~C. Kirby
Reply all
Reply to author
Forward
0 new messages