Skip to main content

No project description provided

Project description

django filter groups

This package groups filters generated by django-filter The main reason to use it - don't show all filters (show only selected filters)

how to use

pip install django-filter-groups

add to your INSTALLED_APPS after django-filter

INSTALLED_APPS = [
  ...
  "django_filters",
  "django_filters_groups",
  ...
]

use it in your template:

  • add {% add_select_filter_form_to_context %} to the top of your template. It allows you to place {{ select_filter_form.media }} anywhere you want
  • add {% filters_by_groups %}
  • add {{ select_filter_form.media }}

If FilterSet name is not 'filter' -> add filterset
{% add_select_filter_form_to_context my_custom_filterset %}
{% filters_by_groups my_custom_filterset %} or filterset name {% filters_by_groups "my_custom_filterset" %} {% add_select_filter_form_to_context "my_custom_filterset" %}

default settings

# django settings
FILTERS_GROUPS_SELECT_FILTER_FORM_LABEL = "Select a label"
// static/django_filters_groups/filter-defaults.js
let filterDefaults = {
  filterWrapperSelector: "p", // p is necessary when you use {{ form.as_p }}
  submitOnFilterDelete: false,
};

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-filter-groups-0.4.0.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

django_filter_groups-0.4.0-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page