From 92c74b0f102f523d8d2fba102f7f32effbf24f91 Mon Sep 17 00:00:00 2001 From: Kunal Grover Date: Sat, 30 Jun 2018 18:43:40 +0530 Subject: [PATCH 1/2] Add documentation for using in Custom filters --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index cb6a220..d7317ac 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,18 @@ class EntityAdmin(admin.ModelAdmin): # for related fields ('a_foreignkey_field', RelatedDropdownFilter), ) + + +# Use with custom filters by overriding the template +class CustomFilter(SimpleListFilter): + template = 'django_admin_listfilter_dropdown/dropdown_filter.html' + + def lookups(self, request, model_admin): + # Lookups to be used + + def queryset(self, request, queryset): + # QS filtering + ``` # Example From 3ec26fd1a10e08ad56bb3a0faf3f490ffc5c6586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=20S=C3=B5mermaa?= Date: Sun, 21 Oct 2018 23:31:15 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d7317ac..5e8b495 100644 --- a/README.md +++ b/README.md @@ -40,18 +40,19 @@ class EntityAdmin(admin.ModelAdmin): # for related fields ('a_foreignkey_field', RelatedDropdownFilter), ) +``` +Example of a custom filter that uses the provided template: -# Use with custom filters by overriding the template +```py class CustomFilter(SimpleListFilter): template = 'django_admin_listfilter_dropdown/dropdown_filter.html' def lookups(self, request, model_admin): - # Lookups to be used + ... def queryset(self, request, queryset): - # QS filtering - + ... ``` # Example