PyInventory 0.23.2__tar.gz → 0.24.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyinventory-0.23.2 → pyinventory-0.24.0}/PKG-INFO +7 -4
- {pyinventory-0.23.2 → pyinventory-0.24.0}/README.md +6 -3
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/__init__.py +1 -1
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/base.py +36 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/item.py +5 -4
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_admin_location_empty_change_list_1.snapshot.html +3 -10
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_item.py +19 -20
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_item_auto_group_items_1.snapshot.html +3 -10
- {pyinventory-0.23.2 → pyinventory-0.24.0}/uv.lock +152 -101
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.editorconfig +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.github/workflows/tests.yml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.gitignore +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.idea/.gitignore +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.pre-commit-config.yaml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.pre-commit-hooks.yaml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.run/Template Django tests.run.xml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.run/Template Python.run.xml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.run/manage.py --help.run.xml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.run/manage.py make_messages.run.xml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.run/manage.py update_req.run.xml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/.run/unittests ___all___.run.xml +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/AUTHORS +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/LICENSE +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/dist/.gitignore +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/location.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/memo.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/tests/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/tests/test_item.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/admin/tests/test_item_happy_path_1.snapshot.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/apps.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/checks.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/ckeditor_upload.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/constants.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/context_processors.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/forms.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/ca/LC_MESSAGES/django.mo +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/ca/LC_MESSAGES/django.po +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/de/LC_MESSAGES/django.mo +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/de/LC_MESSAGES/django.po +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/en/LC_MESSAGES/django.mo +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/en/LC_MESSAGES/django.po +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/es/LC_MESSAGES/django.mo +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/locale/es/LC_MESSAGES/django.po +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/management/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/management/commands/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/management/commands/seed_data.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/management/commands/tree.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/middlewares.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0001_initial.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0002_auto_20201017_2211.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0003_auto_20201024_1830.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0004_item_user_images.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0005_serve_uploads_by_django_tools.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0006_refactor_image_model.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0007_add_file_attachment.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0008_last_check_datetime.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0009_add_memo.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0010_version_protect_models.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0011_parent_tree1.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0012_parent_tree2.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0013_alter_itemmodel_location.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0014_alter_itemmodel_description_and_more.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/0015_itemmaincategory_itemmodel_category.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/migrations/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/models/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/models/base.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/models/item.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/models/links.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/models/location.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/models/memo.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/parent_tree.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/permissions.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/persistent_filters.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/request_dict.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/signals.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/static/PyInventory_Logo.svg +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/static/inventory.css +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/string_utils.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/templates/admin/item/mass_change_category_action.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/templates/admin/item/related_items.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/templates/admin/location/items.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/fixtures/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/fixtures/users.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_admin_location.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_item_images.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_link_model.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_management_command_seed_data.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_management_command_tree.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_parent_tree.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory/tests/test_parent_tree_model.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/__main__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/middlewares.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/settings/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/settings/local.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/settings/prod.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/settings/tests.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/templates/admin/base_site.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/templates/admin/login.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/__init__.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/fixtures.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/mocks.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/playwright_utils.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_item_login_1.snapshot.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_item_normal_user_create_minimal_item_1.snapshot.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_item_normal_user_create_minimal_item_2.snapshot.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_memo.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_memo_normal_user_create_minimal_item_1.snapshot.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_admin_superuser_admin_index_1.snapshot.html +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_inventory_commands.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_inventory_commands_help_1.snapshot.txt +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_migrations.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_models_item.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_playwright_admin.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_project_setup.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/tests/test_readme_history.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/urls.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/inventory_project/wsgi.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/manage.py +0 -0
- {pyinventory-0.23.2 → pyinventory-0.24.0}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyInventory
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.24.0
|
|
4
4
|
Summary: Web based management to catalog things including state and location etc. using Python/Django.
|
|
5
5
|
Project-URL: Documentation, https://github.com/jedie/PyInventory
|
|
6
6
|
Project-URL: Source, https://github.com/jedie/PyInventory
|
|
@@ -199,6 +199,9 @@ To make a new release, do this:
|
|
|
199
199
|
|
|
200
200
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
201
201
|
|
|
202
|
+
* [v0.24.0](https://github.com/jedie/PyInventory/compare/v0.23.2...v0.24.0)
|
|
203
|
+
* 2025-12-02 - Use facets always and auto hide empty item filters
|
|
204
|
+
* 2025-12-02 - Update requirements
|
|
202
205
|
* [v0.23.2](https://github.com/jedie/PyInventory/compare/v0.23.1...v0.23.2)
|
|
203
206
|
* 2025-11-28 - Fix logo if static path is not just "/static/"
|
|
204
207
|
* [v0.23.1](https://github.com/jedie/PyInventory/compare/v0.23.0...v0.23.1)
|
|
@@ -210,12 +213,12 @@ To make a new release, do this:
|
|
|
210
213
|
* 2025-11-25 - Remove django-tagulous work-a-round, because it's fixed.
|
|
211
214
|
* 2025-11-19 - Add admin action to change the category of selected items
|
|
212
215
|
* 2025-11-19 - Remove "GHSA-4xh5-x5gv-qwph" exception
|
|
213
|
-
* [v0.22.1](https://github.com/jedie/PyInventory/compare/v0.22.0...v0.22.1)
|
|
214
|
-
* 2025-11-18 - Fix #207 "All" Category can't be selected
|
|
215
|
-
* 2025-11-18 - Update requirements
|
|
216
216
|
|
|
217
217
|
<details><summary>Expand older history entries ...</summary>
|
|
218
218
|
|
|
219
|
+
* [v0.22.1](https://github.com/jedie/PyInventory/compare/v0.22.0...v0.22.1)
|
|
220
|
+
* 2025-11-18 - Fix #207 "All" Category can't be selected
|
|
221
|
+
* 2025-11-18 - Update requirements
|
|
219
222
|
* [v0.22.0](https://github.com/jedie/PyInventory/compare/v0.21.4...v0.22.0)
|
|
220
223
|
* 2025-10-16 - Add tests for PersistentRelatedFieldListFilter
|
|
221
224
|
* 2025-09-21 - NEW: Add a persistent "Main Category"
|
|
@@ -169,6 +169,9 @@ To make a new release, do this:
|
|
|
169
169
|
|
|
170
170
|
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)
|
|
171
171
|
|
|
172
|
+
* [v0.24.0](https://github.com/jedie/PyInventory/compare/v0.23.2...v0.24.0)
|
|
173
|
+
* 2025-12-02 - Use facets always and auto hide empty item filters
|
|
174
|
+
* 2025-12-02 - Update requirements
|
|
172
175
|
* [v0.23.2](https://github.com/jedie/PyInventory/compare/v0.23.1...v0.23.2)
|
|
173
176
|
* 2025-11-28 - Fix logo if static path is not just "/static/"
|
|
174
177
|
* [v0.23.1](https://github.com/jedie/PyInventory/compare/v0.23.0...v0.23.1)
|
|
@@ -180,12 +183,12 @@ To make a new release, do this:
|
|
|
180
183
|
* 2025-11-25 - Remove django-tagulous work-a-round, because it's fixed.
|
|
181
184
|
* 2025-11-19 - Add admin action to change the category of selected items
|
|
182
185
|
* 2025-11-19 - Remove "GHSA-4xh5-x5gv-qwph" exception
|
|
183
|
-
* [v0.22.1](https://github.com/jedie/PyInventory/compare/v0.22.0...v0.22.1)
|
|
184
|
-
* 2025-11-18 - Fix #207 "All" Category can't be selected
|
|
185
|
-
* 2025-11-18 - Update requirements
|
|
186
186
|
|
|
187
187
|
<details><summary>Expand older history entries ...</summary>
|
|
188
188
|
|
|
189
|
+
* [v0.22.1](https://github.com/jedie/PyInventory/compare/v0.22.0...v0.22.1)
|
|
190
|
+
* 2025-11-18 - Fix #207 "All" Category can't be selected
|
|
191
|
+
* 2025-11-18 - Update requirements
|
|
189
192
|
* [v0.22.0](https://github.com/jedie/PyInventory/compare/v0.21.4...v0.22.0)
|
|
190
193
|
* 2025-10-16 - Add tests for PersistentRelatedFieldListFilter
|
|
191
194
|
* 2025-09-21 - NEW: Add a persistent "Main Category"
|
|
@@ -19,6 +19,7 @@ class UserInlineMixin:
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class BaseUserAdmin(CompareVersionAdmin):
|
|
22
|
+
show_facets = admin.ShowFacets.ALWAYS
|
|
22
23
|
form = OnlyUserRelationsModelForm
|
|
23
24
|
|
|
24
25
|
def get_changelist(self, request, **kwargs):
|
|
@@ -102,3 +103,38 @@ class LimitTreeDepthListFilter(admin.SimpleListFilter):
|
|
|
102
103
|
if level:
|
|
103
104
|
level = int(level)
|
|
104
105
|
return queryset.filter(level__lte=level)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class NoneEmptyRelatedFieldListFilter(admin.RelatedOnlyFieldListFilter):
|
|
109
|
+
"""
|
|
110
|
+
Display only choices that results **not** in an empty change list!
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
def choices(self, changelist):
|
|
114
|
+
assert changelist.add_facets, f'Facets must be enabled to use {self.__class__.__name__}'
|
|
115
|
+
|
|
116
|
+
facet_counts = self.get_facet_queryset(changelist)
|
|
117
|
+
yield {
|
|
118
|
+
'selected': self.lookup_val is None and not self.lookup_val_isnull,
|
|
119
|
+
'query_string': changelist.get_query_string(remove=[self.lookup_kwarg, self.lookup_kwarg_isnull]),
|
|
120
|
+
'display': _('All'),
|
|
121
|
+
}
|
|
122
|
+
for pk_val, val in self.lookup_choices:
|
|
123
|
+
if count := facet_counts[f'{pk_val}__c']:
|
|
124
|
+
yield {
|
|
125
|
+
'selected': self.lookup_val is not None and str(pk_val) in self.lookup_val,
|
|
126
|
+
'query_string': changelist.get_query_string(
|
|
127
|
+
{self.lookup_kwarg: pk_val}, [self.lookup_kwarg_isnull]
|
|
128
|
+
),
|
|
129
|
+
'display': f'{val} ({count})',
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if self.include_empty_choice:
|
|
133
|
+
if count := facet_counts['__c']:
|
|
134
|
+
yield {
|
|
135
|
+
'selected': bool(self.lookup_val_isnull),
|
|
136
|
+
'query_string': changelist.get_query_string(
|
|
137
|
+
{self.lookup_kwarg_isnull: 'True'}, [self.lookup_kwarg]
|
|
138
|
+
),
|
|
139
|
+
'display': f'{self.empty_value_display} ({count})',
|
|
140
|
+
}
|
|
@@ -19,6 +19,7 @@ from inventory.admin.base import (
|
|
|
19
19
|
BaseImageModelInline,
|
|
20
20
|
BaseUserAdmin,
|
|
21
21
|
LimitTreeDepthListFilter,
|
|
22
|
+
NoneEmptyRelatedFieldListFilter,
|
|
22
23
|
UserInlineMixin,
|
|
23
24
|
)
|
|
24
25
|
from inventory.models import ItemLinkModel, ItemModel
|
|
@@ -150,10 +151,10 @@ class ItemModelAdmin(ImportExportMixin, SortableAdminBase, BaseUserAdmin):
|
|
|
150
151
|
list_filter = (
|
|
151
152
|
('category', PersistentRelatedFieldListFilter),
|
|
152
153
|
LimitTreeDepthListFilter,
|
|
153
|
-
('kind',
|
|
154
|
-
('location',
|
|
155
|
-
('producer',
|
|
156
|
-
('tags',
|
|
154
|
+
('kind', NoneEmptyRelatedFieldListFilter),
|
|
155
|
+
('location', NoneEmptyRelatedFieldListFilter),
|
|
156
|
+
('producer', NoneEmptyRelatedFieldListFilter),
|
|
157
|
+
('tags', NoneEmptyRelatedFieldListFilter),
|
|
157
158
|
)
|
|
158
159
|
search_fields = ('name', 'description', 'kind__name', 'tags__name')
|
|
159
160
|
fieldsets = (
|
|
@@ -50,13 +50,6 @@
|
|
|
50
50
|
<h2 id="changelist-filter-header">
|
|
51
51
|
Filter
|
|
52
52
|
</h2>
|
|
53
|
-
<div id="changelist-filter-extra-actions">
|
|
54
|
-
<h3>
|
|
55
|
-
<a class="viewlink" href="?_facets=True">
|
|
56
|
-
Show counts
|
|
57
|
-
</a>
|
|
58
|
-
</h3>
|
|
59
|
-
</div>
|
|
60
53
|
<details data-filter-title="Limit tree depth" open="">
|
|
61
54
|
<summary>
|
|
62
55
|
By Limit tree depth
|
|
@@ -69,17 +62,17 @@
|
|
|
69
62
|
</li>
|
|
70
63
|
<li>
|
|
71
64
|
<a href="?level=1">
|
|
72
|
-
Only root
|
|
65
|
+
Only root (0)
|
|
73
66
|
</a>
|
|
74
67
|
</li>
|
|
75
68
|
<li>
|
|
76
69
|
<a href="?level=2">
|
|
77
|
-
Root + first sub
|
|
70
|
+
Root + first sub (0)
|
|
78
71
|
</a>
|
|
79
72
|
</li>
|
|
80
73
|
<li>
|
|
81
74
|
<a href="?level=3">
|
|
82
|
-
Root + first + second sub
|
|
75
|
+
Root + first + second sub (0)
|
|
83
76
|
</a>
|
|
84
77
|
</li>
|
|
85
78
|
</ul>
|
|
@@ -265,28 +265,27 @@ class AdminTestCase(HtmlAssertionMixin, TestCase):
|
|
|
265
265
|
)
|
|
266
266
|
with self.assertLogs('inventory.persistent_filters', level=logging.DEBUG) as logs:
|
|
267
267
|
response = self.client.get(path='/admin/inventory/itemmodel/')
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
)
|
|
283
|
-
)
|
|
268
|
+
self.assertEqual(
|
|
269
|
+
list(response.context_data['cl'].queryset.values_list('name', flat=True)), ['Item 1', 'Item 2']
|
|
270
|
+
)
|
|
271
|
+
self.assert_html_parts(
|
|
272
|
+
response,
|
|
273
|
+
parts=(
|
|
274
|
+
'<h1>Select Item to change</h1>',
|
|
275
|
+
'<a href="/admin/inventory/itemmodel/80dddef9-0000-0000-0000-000000000001/change/">'
|
|
276
|
+
'<strong>Item 1</strong></a>',
|
|
277
|
+
'<a href="/admin/inventory/itemmodel/80dddef9-0000-0000-0000-000000000002/change/">'
|
|
278
|
+
'<strong>Item 2</strong></a>',
|
|
279
|
+
'<a href="?category__id__exact=1">Category 1 (1)</a>',
|
|
280
|
+
'<a href="?category__id__exact=2">Category 2 (1)</a>',
|
|
281
|
+
),
|
|
282
|
+
)
|
|
284
283
|
self.assertEqual(
|
|
285
284
|
logs.output,
|
|
286
285
|
[
|
|
287
286
|
'DEBUG:inventory.persistent_filters:'
|
|
288
287
|
"Restore None from 'persistent_parameter_1_inventory_itemmodel_category__id__exact'"
|
|
289
|
-
],
|
|
288
|
+
] * 3, # 3 times called because of facet counts :(
|
|
290
289
|
)
|
|
291
290
|
|
|
292
291
|
with self.assertLogs('inventory.persistent_filters', level=logging.DEBUG) as logs:
|
|
@@ -296,7 +295,7 @@ class AdminTestCase(HtmlAssertionMixin, TestCase):
|
|
|
296
295
|
[
|
|
297
296
|
'DEBUG:inventory.persistent_filters:'
|
|
298
297
|
"Store '2' to 'persistent_parameter_1_inventory_itemmodel_category__id__exact'"
|
|
299
|
-
],
|
|
298
|
+
] * 3, # 3 times called because of facet counts :(
|
|
300
299
|
)
|
|
301
300
|
# Only items from category 2:
|
|
302
301
|
self.assertEqual(list(response.context_data['cl'].queryset.values_list('name', flat=True)), ['Item 2'])
|
|
@@ -310,7 +309,7 @@ class AdminTestCase(HtmlAssertionMixin, TestCase):
|
|
|
310
309
|
"DEBUG:inventory.persistent_filters:"
|
|
311
310
|
"Restore '2' from 'persistent_parameter_1_inventory_itemmodel_category__id__exact'",
|
|
312
311
|
"INFO:inventory.persistent_filters:Restore 'category' filter for itemmodel with '2'",
|
|
313
|
-
],
|
|
312
|
+
] * 3, # 3 times called because of facet counts :(
|
|
314
313
|
)
|
|
315
314
|
# Only items from category 2:
|
|
316
315
|
self.assertEqual(list(response.context_data['cl'].queryset.values_list('name', flat=True)), ['Item 2'])
|
|
@@ -323,7 +322,7 @@ class AdminTestCase(HtmlAssertionMixin, TestCase):
|
|
|
323
322
|
[
|
|
324
323
|
'DEBUG:inventory.persistent_filters:'
|
|
325
324
|
"Store '1' to 'persistent_parameter_1_inventory_itemmodel_category__id__exact'"
|
|
326
|
-
],
|
|
325
|
+
] * 3, # 3 times called because of facet counts :(
|
|
327
326
|
)
|
|
328
327
|
# Only items from category 1:
|
|
329
328
|
self.assertEqual(list(response.context_data['cl'].queryset.values_list('name', flat=True)), ['Item 1'])
|
|
@@ -338,13 +338,6 @@
|
|
|
338
338
|
<h2 id="changelist-filter-header">
|
|
339
339
|
Filter
|
|
340
340
|
</h2>
|
|
341
|
-
<div id="changelist-filter-extra-actions">
|
|
342
|
-
<h3>
|
|
343
|
-
<a class="viewlink" href="?_facets=True">
|
|
344
|
-
Show counts
|
|
345
|
-
</a>
|
|
346
|
-
</h3>
|
|
347
|
-
</div>
|
|
348
341
|
<details data-filter-title="Limit tree depth" open="">
|
|
349
342
|
<summary>
|
|
350
343
|
By Limit tree depth
|
|
@@ -357,17 +350,17 @@
|
|
|
357
350
|
</li>
|
|
358
351
|
<li>
|
|
359
352
|
<a href="?level=1">
|
|
360
|
-
Only root
|
|
353
|
+
Only root (2)
|
|
361
354
|
</a>
|
|
362
355
|
</li>
|
|
363
356
|
<li>
|
|
364
357
|
<a href="?level=2">
|
|
365
|
-
Root + first sub
|
|
358
|
+
Root + first sub (6)
|
|
366
359
|
</a>
|
|
367
360
|
</li>
|
|
368
361
|
<li>
|
|
369
362
|
<a href="?level=3">
|
|
370
|
-
Root + first + second sub
|
|
363
|
+
Root + first + second sub (6)
|
|
371
364
|
</a>
|
|
372
365
|
</li>
|
|
373
366
|
</ul>
|