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
Built Distribution
Close
Hashes for django-filter-groups-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 418120bb13e16c1766aada6e69bdd05db98c521f9aec01ebb7d82d73fa1e94ea |
|
MD5 | b1501af5ae70bf5c8e828d5face551a9 |
|
BLAKE2b-256 | b76bdd8bb47f64dcc5ae169085641bd19c6d688858b373137d39452aa551ba1f |
Close
Hashes for django_filter_groups-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6fee0ecbd886f67bbe32499221be3f5d1e3bda1b05bca1bd9425cce7f4be6ab |
|
MD5 | 1aac658d544415ac11dac0e8ae97c7ca |
|
BLAKE2b-256 | 506d80b4851746639744e0ca80bb75099677649b6eb365a297667fd60984b871 |