django-easyfilters / docs / filters.rst

Filters

When you specify the fields attribute on a :class:`~django_easyfilters.FilterSet` subclass, various different Filter classes will be chosen depending on the type of field. They are listed below, with the keyword argument options that they take.

At the moment, all other methods of Filter and subclasses are considered private implementation details, until all the Filters are implemented and the API firms up.

This is the base class for all filters, and has provides some options:

  • query_param:

    The parameter in the query string that will be used for this field. This can be useful for shortening the query strings that are generated.

  • order_by_count:

    Default: False

    If True, this will cause the choices to be sorted so that the choices with the largest 'count' appear first.

This is used for ForeignKey fields

This is used for ManyToMany fields

This is used for fields that have 'choices' defined. The choices presented will be in the order specified in 'choices'.

This is the most complex of the filters, as it allows drill-down from year to month to day. It takes the following options:

  • max_links

    Default: 12

    The maximum number of links to display. If the number of choices at any level does not fit into this value, ranges will be used to shrink the number of choices.

  • max_depth

    Default: None

    If 'year' or 'month' is specified, the drill-down will be limited to that level.

This is the fallback that is used when nothing else matches.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.