Skip to content

Chaining and Logic

Up to this point, we have been including a single filter in all of our searches.

Quite often you might want to combine multiple filters to further narrow down your results. You can do this by using multiple filters:

List Sites > Which belong to Project ID 1701 > AND > Have a name case-insensitively containing the text "Foo"

/api/projects/locations/?site__project=1701&name__icontains=Foo

Logic

Notice that the filters in the above example combine, by default, with AND logic to return only the results which match both criteria.

If you would rather use OR logic to combine your filters, you can add the or_logic query parameter

or_logic Value

You don't need to include a value for or_logic. Just its presence as a query paremeter is enough to trigger the logic change.

List Sites > Which belong to Project ID 1701 > OR > Have a name case-insensitively containing the text "Foo"

/api/projects/locations/?or_logic&site__project=1701&name__icontains=Foo