Settings

class rest_filters.conf.AppSettings

There are a few settings that change how rest-filters behaves globally. Most of these settings can also be changed on a per-FilterSet basis.

You can use these settings by adding the REST_FILTERS setting to your Django configuration file. For example:

REST_FILTERS = {
    "BLANK": "keep",
    "KNOWN_PARAMETERS": ["page", "page_size"],
}
BLANK: Literal['keep', 'omit'] = 'omit'

Determines how empty query parameters are handled. Default is omit which behaves as if query parameter was not provided. Setting this to keep will cause empty values to be parsed by the related field.

DEFAULT_GROUP: str = 'chain'

The default group for filters. By default, this is set to the reserved group chain, which will chain filter() calls for each resolved query expression.

HANDLE_UNKNOWN_PARAMETERS: bool = True

Decides whether to handle unknown parameters.

KNOWN_PARAMETERS: list[str] = 1

A list of query parameters that are not defined in FilterSet but otherwise used by other mechanisms, such as pagination.

By default, the following query parameters are marked as known:

  • page

  • page_size

  • cursor

  • api_settings.ORDERING_PARAM

  • api_settings.VERSION_PARAM

  • api_settings.URL_FORMAT_OVERRIDE