From 99a220ac8a9d61536f0c26785a24bb61b6d99402 Mon Sep 17 00:00:00 2001 From: wuyue Date: Thu, 30 Jun 2022 10:31:05 +0800 Subject: [PATCH 1/2] fix exception when delete in changelist_view --- adminlteui/admin.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/adminlteui/admin.py b/adminlteui/admin.py index f008c3d..b2da052 100644 --- a/adminlteui/admin.py +++ b/adminlteui/admin.py @@ -62,16 +62,18 @@ class Media: def changelist_view(self, request, extra_context=None): view = super().changelist_view(request, extra_context) - cl = view.context_data.get('cl') - cl.search_field_placeholder = self.search_field_placeholder - filter_specs = cl.filter_specs - - for index, filter_spec in enumerate(filter_specs): - if filter_spec.field_path in self.select2_list_filter: - # flag to use select2 - filter_spec.display_select2 = True - cl.filter_specs[index] = filter_spec - view.context_data['cl'] = cl + if hasattr(view, 'context_data'): + cl = view.context_data.get('cl', None) + if cl: + cl.search_field_placeholder = self.search_field_placeholder + filter_specs = cl.filter_specs + + for index, filter_spec in enumerate(filter_specs): + if filter_spec.field_path in self.select2_list_filter: + # flag to use select2 + filter_spec.display_select2 = True + cl.filter_specs[index] = filter_spec + view.context_data['cl'] = cl return view From c47ec55fbb4b73316fd3c2487a8aebe6b77b7165 Mon Sep 17 00:00:00 2001 From: wuyue Date: Thu, 30 Jun 2022 10:34:11 +0800 Subject: [PATCH 2/2] update version to 1.7.1 --- adminlteui/__init__.py | 2 +- docs/about.md | 3 +++ docs/guide.md | 22 ++++++++++++---------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/adminlteui/__init__.py b/adminlteui/__init__.py index 1e00a3b..faacc94 100644 --- a/adminlteui/__init__.py +++ b/adminlteui/__init__.py @@ -1,2 +1,2 @@ -version = '1.7.0' +version = '1.7.1' default_app_config = 'adminlteui.apps.AdminlteUIConfig' diff --git a/docs/about.md b/docs/about.md index 58834d4..b591e09 100644 --- a/docs/about.md +++ b/docs/about.md @@ -1,4 +1,7 @@ # ChangeLog +## [v1.7.1](https://github.com/wuyue92tree/django-adminlte-ui/releases/tag/1.7.0) +- fix exception when delete in changelist_view +- update docs ## [v1.7.0](https://github.com/wuyue92tree/django-adminlte-ui/releases/tag/1.7.0) - make previous & next button effective on change_list.html diff --git a/docs/guide.md b/docs/guide.md index f3cf120..b9f7a94 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -264,17 +264,19 @@ Modify apps icon & order apps/models ```python ADMINLTE_SETTINGS = { - 'example-app': { - 'icon': 'fa-desktop', - 'models': { - 'example-model': { - 'icon': 'fa-archive' - }, - 'example-model1': {} + 'apps': { + 'example-app': { + 'icon': 'fa-desktop', + 'models': { + 'example-model': { + 'icon': 'fa-archive' + }, + 'example-model1': {} + } + }, + 'auth': { + 'icon': 'fa-users' } - }, - 'auth': { - 'icon': 'fa-users' } } ``` \ No newline at end of file