PyInventory 0.19.0__py3-none-any.whl
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.19.0.dist-info/AUTHORS +14 -0
- PyInventory-0.19.0.dist-info/LICENSE +674 -0
- PyInventory-0.19.0.dist-info/METADATA +347 -0
- PyInventory-0.19.0.dist-info/RECORD +101 -0
- PyInventory-0.19.0.dist-info/WHEEL +5 -0
- PyInventory-0.19.0.dist-info/entry_points.txt +2 -0
- PyInventory-0.19.0.dist-info/top_level.txt +2 -0
- inventory/__init__.py +7 -0
- inventory/admin/__init__.py +3 -0
- inventory/admin/base.py +104 -0
- inventory/admin/item.py +169 -0
- inventory/admin/location.py +78 -0
- inventory/admin/memo.py +76 -0
- inventory/admin/tagulous_fix.py +45 -0
- inventory/apps.py +18 -0
- inventory/ckeditor_upload.py +15 -0
- inventory/context_processors.py +5 -0
- inventory/forms.py +36 -0
- inventory/locale/ca/LC_MESSAGES/django.mo +0 -0
- inventory/locale/ca/LC_MESSAGES/django.po +297 -0
- inventory/locale/de/LC_MESSAGES/django.mo +0 -0
- inventory/locale/de/LC_MESSAGES/django.po +294 -0
- inventory/locale/en/LC_MESSAGES/django.mo +0 -0
- inventory/locale/en/LC_MESSAGES/django.po +294 -0
- inventory/locale/es/LC_MESSAGES/django.mo +0 -0
- inventory/locale/es/LC_MESSAGES/django.po +297 -0
- inventory/management/__init__.py +0 -0
- inventory/management/commands/__init__.py +0 -0
- inventory/management/commands/seed_data.py +135 -0
- inventory/management/commands/tree.py +62 -0
- inventory/middlewares.py +21 -0
- inventory/migrations/0001_initial.py +596 -0
- inventory/migrations/0002_auto_20201017_2211.py +87 -0
- inventory/migrations/0003_auto_20201024_1830.py +23 -0
- inventory/migrations/0004_item_user_images.py +129 -0
- inventory/migrations/0005_serve_uploads_by_django_tools.py +77 -0
- inventory/migrations/0006_refactor_image_model.py +46 -0
- inventory/migrations/0007_add_file_attachment.py +128 -0
- inventory/migrations/0008_last_check_datetime.py +23 -0
- inventory/migrations/0009_add_memo.py +517 -0
- inventory/migrations/0010_version_protect_models.py +37 -0
- inventory/migrations/0011_parent_tree1.py +97 -0
- inventory/migrations/0012_parent_tree2.py +20 -0
- inventory/migrations/0013_alter_itemmodel_location.py +26 -0
- inventory/migrations/__init__.py +0 -0
- inventory/models/__init__.py +3 -0
- inventory/models/base.py +239 -0
- inventory/models/item.py +228 -0
- inventory/models/links.py +104 -0
- inventory/models/location.py +24 -0
- inventory/models/memo.py +109 -0
- inventory/parent_tree.py +71 -0
- inventory/permissions.py +60 -0
- inventory/request_dict.py +16 -0
- inventory/signals.py +15 -0
- inventory/string_utils.py +15 -0
- inventory/templates/admin/item/related_items.html +18 -0
- inventory/templates/admin/location/items.html +18 -0
- inventory/tests/__init__.py +0 -0
- inventory/tests/fixtures/__init__.py +0 -0
- inventory/tests/fixtures/users.py +11 -0
- inventory/tests/test_admin_location.py +34 -0
- inventory/tests/test_admin_location_empty_change_list_1.snapshot.html +84 -0
- inventory/tests/test_item_images.py +76 -0
- inventory/tests/test_link_model.py +72 -0
- inventory/tests/test_management_command_seed_data.py +49 -0
- inventory/tests/test_management_command_tree.py +27 -0
- inventory/tests/test_parent_tree.py +40 -0
- inventory/tests/test_parent_tree_model.py +139 -0
- inventory_project/__init__.py +12 -0
- inventory_project/__main__.py +17 -0
- inventory_project/manage.py +41 -0
- inventory_project/middlewares.py +23 -0
- inventory_project/publish.py +21 -0
- inventory_project/settings/__init__.py +0 -0
- inventory_project/settings/local.py +74 -0
- inventory_project/settings/prod.py +393 -0
- inventory_project/settings/tests.py +45 -0
- inventory_project/templates/admin/base_site.html +22 -0
- inventory_project/templates/admin/login.html +32 -0
- inventory_project/tests/__init__.py +0 -0
- inventory_project/tests/fixtures.py +40 -0
- inventory_project/tests/mocks.py +15 -0
- inventory_project/tests/playwright_utils.py +22 -0
- inventory_project/tests/test_admin.py +15 -0
- inventory_project/tests/test_admin_item.py +240 -0
- inventory_project/tests/test_admin_item_auto_group_items_1.snapshot.html +349 -0
- inventory_project/tests/test_admin_item_auto_group_items_2.snapshot.html +232 -0
- inventory_project/tests/test_admin_item_login_1.snapshot.html +40 -0
- inventory_project/tests/test_admin_item_normal_user_create_minimal_item_1.snapshot.html +637 -0
- inventory_project/tests/test_admin_item_normal_user_create_minimal_item_2.snapshot.html +930 -0
- inventory_project/tests/test_admin_memo.py +153 -0
- inventory_project/tests/test_admin_memo_normal_user_create_minimal_item_1.snapshot.html +365 -0
- inventory_project/tests/test_command_shell_help_django4.2.3.snapshot.txt +60 -0
- inventory_project/tests/test_inventory_commands.py +26 -0
- inventory_project/tests/test_migrations.py +22 -0
- inventory_project/tests/test_models_item.py +24 -0
- inventory_project/tests/test_playwright_admin.py +157 -0
- inventory_project/tests/test_project_setup.py +102 -0
- inventory_project/urls.py +21 -0
- inventory_project/wsgi.py +9 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: PyInventory
|
|
3
|
+
Version: 0.19.0
|
|
4
|
+
Summary: Web based management to catalog things including state and location etc. using Python/Django.
|
|
5
|
+
Author-email: Jens Diemer <PyInventory@jensdiemer.de>
|
|
6
|
+
License: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Documentation, https://github.com/jedie/PyInventory
|
|
8
|
+
Project-URL: Source, https://github.com/jedie/PyInventory
|
|
9
|
+
Keywords: inventory,django
|
|
10
|
+
Requires-Python: <4,>=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: AUTHORS
|
|
14
|
+
Requires-Dist: colorlog
|
|
15
|
+
Requires-Dist: gunicorn
|
|
16
|
+
Requires-Dist: django
|
|
17
|
+
Requires-Dist: django-import-export
|
|
18
|
+
Requires-Dist: django-dbbackup
|
|
19
|
+
Requires-Dist: django-tools
|
|
20
|
+
Requires-Dist: django-reversion-compare
|
|
21
|
+
Requires-Dist: django-ckeditor
|
|
22
|
+
Requires-Dist: django-tagulous
|
|
23
|
+
Requires-Dist: django-admin-sortable2
|
|
24
|
+
Requires-Dist: pillow
|
|
25
|
+
Requires-Dist: django-debug-toolbar
|
|
26
|
+
Requires-Dist: bx-py-utils
|
|
27
|
+
Requires-Dist: bx-django-utils
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: manage-django-project (>=0.3.0) ; extra == 'dev'
|
|
30
|
+
Requires-Dist: cmd2-ext-test ; extra == 'dev'
|
|
31
|
+
Requires-Dist: playwright ; extra == 'dev'
|
|
32
|
+
Requires-Dist: beautifulsoup4 ; extra == 'dev'
|
|
33
|
+
Requires-Dist: tblib ; extra == 'dev'
|
|
34
|
+
Requires-Dist: pip-tools ; extra == 'dev'
|
|
35
|
+
Requires-Dist: tox ; extra == 'dev'
|
|
36
|
+
Requires-Dist: coverage ; extra == 'dev'
|
|
37
|
+
Requires-Dist: autopep8 ; extra == 'dev'
|
|
38
|
+
Requires-Dist: pyupgrade ; extra == 'dev'
|
|
39
|
+
Requires-Dist: flake8 ; extra == 'dev'
|
|
40
|
+
Requires-Dist: pyflakes ; extra == 'dev'
|
|
41
|
+
Requires-Dist: codespell ; extra == 'dev'
|
|
42
|
+
Requires-Dist: EditorConfig ; extra == 'dev'
|
|
43
|
+
Requires-Dist: safety ; extra == 'dev'
|
|
44
|
+
Requires-Dist: mypy ; extra == 'dev'
|
|
45
|
+
Requires-Dist: twine ; extra == 'dev'
|
|
46
|
+
Requires-Dist: darker[color,flynt,isort] ; extra == 'dev'
|
|
47
|
+
Requires-Dist: tomli ; extra == 'dev'
|
|
48
|
+
Requires-Dist: typing-extensions (>=3.10) ; extra == 'dev'
|
|
49
|
+
Requires-Dist: model-bakery ; extra == 'dev'
|
|
50
|
+
Requires-Dist: requests-mock ; extra == 'dev'
|
|
51
|
+
Requires-Dist: django-override-storage ; extra == 'dev'
|
|
52
|
+
|
|
53
|
+
# PyInventory
|
|
54
|
+
|
|
55
|
+
Web based management to catalog things including state and location etc. using Python/Django.
|
|
56
|
+
Store information in WYSIWYG-HTML-Editor field and tag them and add Files, Images and Links to them.
|
|
57
|
+
|
|
58
|
+
[](https://github.com/jedie/PyInventory/actions/workflows/tests.yml)
|
|
59
|
+
[](https://app.codecov.io/github/jedie/PyInventory)
|
|
60
|
+
[](https://pypi.org/project/PyInventory/)
|
|
61
|
+
[](https://github.com/jedie/PyInventory/blob/main/pyproject.toml)
|
|
62
|
+
[](https://github.com/jedie/PyInventory/blob/main/LICENSE)
|
|
63
|
+
|
|
64
|
+
[](https://install-app.yunohost.org/?app=pyinventory)
|
|
65
|
+
|
|
66
|
+
> [pyinventory_ynh](https://github.com/YunoHost-Apps/pyinventory_ynh) allows you to install PyInventory quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.
|
|
67
|
+
|
|
68
|
+
Pull requests welcome!
|
|
69
|
+
|
|
70
|
+
## about
|
|
71
|
+
|
|
72
|
+
The focus of this project is on the management of retro computing hardware.
|
|
73
|
+
|
|
74
|
+
Current features:
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
* Web-based
|
|
78
|
+
* Multiuser ready (Every user see and manage only his own entries)
|
|
79
|
+
* Chaotic warehousing
|
|
80
|
+
* Grouped "Items" e.g.: Graphics card Foo is in computer Bar
|
|
81
|
+
* Data structure kept as general as possible
|
|
82
|
+
* Manage information to every item:
|
|
83
|
+
* Description: free WYSIWYG-HTML-Editor field
|
|
84
|
+
* Storage location
|
|
85
|
+
* State
|
|
86
|
+
* Images, Files and Web-Links
|
|
87
|
+
* receiving and delivering (when, from whom, at what price, etc.)
|
|
88
|
+
* Manage "Memos" (Information independent of item/location):
|
|
89
|
+
* A free WYSIWYG-HTML-Editor field
|
|
90
|
+
* Tags
|
|
91
|
+
* Images, Files and Web-Links
|
|
92
|
+
|
|
93
|
+
Future ideas:
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
* Information: Publicly visible yes/no
|
|
97
|
+
* A public list of existing items (think about it, you can set in your profile if you want to)
|
|
98
|
+
* administration a wish & exchange list
|
|
99
|
+
|
|
100
|
+
any many more... ;)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## Screenshots
|
|
106
|
+
|
|
107
|
+
More screenshots are here: [jedie.github.io/tree/master/screenshots/PyInventory](https://github.com/jedie/jedie.github.io/blob/master/screenshots/PyInventory/README.creole)
|
|
108
|
+
|
|
109
|
+

|
|
110
|
+
|
|
111
|
+
----
|
|
112
|
+
|
|
113
|
+

|
|
114
|
+
|
|
115
|
+
----
|
|
116
|
+
|
|
117
|
+

|
|
118
|
+
|
|
119
|
+
----
|
|
120
|
+
|
|
121
|
+

|
|
122
|
+
|
|
123
|
+
----
|
|
124
|
+
|
|
125
|
+
## Multi user support
|
|
126
|
+
|
|
127
|
+
PyInventory supports multiple users. The idea:
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
* Every normal user sees only his own created database entries
|
|
131
|
+
* All users used the Django admin
|
|
132
|
+
|
|
133
|
+
Note: All created Tags are shared for all existing users!
|
|
134
|
+
|
|
135
|
+
So setup a normal user:
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
* Set "Staff status"
|
|
139
|
+
* Unset "Superuser status"
|
|
140
|
+
* Add user to "normal_user" group
|
|
141
|
+
* Don't add any additional permissions
|
|
142
|
+
|
|
143
|
+
e.g.:
|
|
144
|
+
|
|
145
|
+

|
|
146
|
+
|
|
147
|
+
More screenshots are here: [jedie.github.io/tree/master/screenshots/PyInventory](https://github.com/jedie/jedie.github.io/blob/master/screenshots/PyInventory/README.creole)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## local development installation
|
|
151
|
+
|
|
152
|
+
e.g.:
|
|
153
|
+
```
|
|
154
|
+
# Clone project (Use your fork SSH url!):
|
|
155
|
+
~$ git clone https://github.com/jedie/PyInventory.git
|
|
156
|
+
~$ cd PyInventory
|
|
157
|
+
~/PyInventory$ ./manage.py
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Helpful for writing and debugging unittests is to run a local test server.
|
|
161
|
+
e.g.:
|
|
162
|
+
```
|
|
163
|
+
~/PyInventory$ ./manage.py run_dev_server
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The web page is available via: `http://127.0.0.1:8000/`
|
|
167
|
+
|
|
168
|
+
You can also pass a other port number or `ipaddr:port` combination. See: `./manage.py run_dev_server --help`
|
|
169
|
+
|
|
170
|
+
Run tests, e.g.:
|
|
171
|
+
```
|
|
172
|
+
~/PyInventory$ ./manage.py test
|
|
173
|
+
~/PyInventory$ ./manage.py coverage
|
|
174
|
+
~/PyInventory$ ./manage.py tox
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Install Playwright browsers, e.g.:
|
|
178
|
+
```
|
|
179
|
+
~/PyInventory$ .venv/bin/playwright install
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Run only Playwright tests with the Playwright Inspector, e.g.:
|
|
183
|
+
```
|
|
184
|
+
~/PyInventory$ PWDEBUG=1 ./manage.py test --tag playwright
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## Backwards-incompatible changes
|
|
189
|
+
|
|
190
|
+
### v0.19.0
|
|
191
|
+
|
|
192
|
+
* Remove ["/development/"](https://github.com/jedie/PyInventory/tree/v0.18.1/deployment) (unmaintained "docker-compose" installation),
|
|
193
|
+
please use YunoHost ;)
|
|
194
|
+
* Removed `django-processinfo` and `django-axes` in test project.
|
|
195
|
+
* Remove `poetry`, `pytest` and `devshell`
|
|
196
|
+
* Use `pip-tools`, `unittests` and [manage_django_project](https://github.com/jedie/manage_django_project)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
## history
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
* [**dev**](https://github.com/jedie/PyInventory/compare/v0.19.0...main)
|
|
203
|
+
* tbc
|
|
204
|
+
* [v0.19.0 - 21.07.2023](https://github.com/jedie/PyInventory/compare/v0.18.1...v0.19.0)
|
|
205
|
+
* Update to Django 4.2
|
|
206
|
+
* Remove `django-processinfo`, `django-axes` and unmaintained "docker-compose" installation
|
|
207
|
+
* Use `pip-tools`, `unittests` and [manage_django_project](https://github.com/jedie/manage_django_project)
|
|
208
|
+
* Bugfix `ItemModelAdmin`
|
|
209
|
+
* [v0.18.1 - 15.06.2023](https://github.com/jedie/PyInventory/compare/v0.18.0...v0.18.1)
|
|
210
|
+
* Update requirements
|
|
211
|
+
* [v0.18.0 - 04.04.2023](https://github.com/jedie/PyInventory/compare/v0.17.0...v0.18.0)
|
|
212
|
+
* Bugfix missing static files by tagulous bug
|
|
213
|
+
* Update requirements and project setup
|
|
214
|
+
* [v0.17.0 - 03.10.2022](https://github.com/jedie/PyInventory/compare/v0.16.0...v0.17.0)
|
|
215
|
+
* NEW: List all related objects on `item` change page with edit links.
|
|
216
|
+
* Change `parent` and `location` fields on `item` change page to a autocompele field.
|
|
217
|
+
* Add search to `location`
|
|
218
|
+
* NEW: List number of item on `location` change list
|
|
219
|
+
* [v0.16.0 - 14.09.2022](https://github.com/jedie/PyInventory/compare/v0.15.0...v0.16.0)
|
|
220
|
+
* Update requirements
|
|
221
|
+
* Bugfix missing CK-Editor
|
|
222
|
+
* Replace Creole base README with markdown
|
|
223
|
+
* Remove Docker stuff from README
|
|
224
|
+
* [v0.15.0 - 19.08.2022](https://github.com/jedie/PyInventory/compare/v0.14.0...v0.15.0)
|
|
225
|
+
* Speedup item change list by prefetch "location"
|
|
226
|
+
* Better changelists for super users
|
|
227
|
+
* Add `./devsetup.py manage seed_data` command to fill the database for development
|
|
228
|
+
* Update requirements
|
|
229
|
+
* Update project setup
|
|
230
|
+
* [v0.14.0 - 24.07.2022](https://github.com/jedie/PyInventory/compare/v0.13.1...v0.14.0)
|
|
231
|
+
* [Fix #102](https://github.com/jedie/PyInventory/issues/102) by remove limitation of item parents.
|
|
232
|
+
* Remove "Group Items" functionality
|
|
233
|
+
* Replace "Group Items" change list filter by "Limit tree depth" for Item and Location.
|
|
234
|
+
* Display Item and Location as a tree.
|
|
235
|
+
* [v0.13.1 - 21.07.2022](https://github.com/jedie/PyInventory/compare/v0.13.0...v0.13.1)
|
|
236
|
+
* Rename git "master" branch into "main"
|
|
237
|
+
* Update CI/Test setup:
|
|
238
|
+
* Use darker and pytest-darker as code formatter
|
|
239
|
+
* Run tests with Python 3.10, too and update requirements
|
|
240
|
+
* Replace Selenium tests with Playwright
|
|
241
|
+
* [v0.13.0 - 01.01.2022](https://github.com/jedie/PyInventory/compare/v0.12.0...v0.13.0)
|
|
242
|
+
* [Update requirements, e.g.: Django v3.2](https://github.com/jedie/PyInventory/pull/83)
|
|
243
|
+
* [v0.12.0 - 22.11.2021](https://github.com/jedie/PyInventory/compare/v0.11.0...v0.12.0)
|
|
244
|
+
* NEW: [Protect user to overwrite newer Item/Memo/Location with a older one (e.g.: in other browser TAB)](https://github.com/jedie/PyInventory/pull/78)
|
|
245
|
+
* update requirements
|
|
246
|
+
* [v0.11.0 - 09.10.2021](https://github.com/jedie/PyInventory/compare/v0.10.1...v0.11.0)
|
|
247
|
+
* NEW: Memo model/admin: Store Information (incl. images/files/links) independent of items/locations
|
|
248
|
+
* Bugfix CKEditor sizes and fix toolbar (e.g.: remove useless pdf generator button and add sourcecode function)
|
|
249
|
+
* [v0.10.1 - 09.10.2021](https://github.com/jedie/PyInventory/compare/v0.10.0...v0.10.1)
|
|
250
|
+
* Update to Django 3.1.x
|
|
251
|
+
* Don't make requests to the a name for a Link, if we already have one or if last request was not long ago.
|
|
252
|
+
* [v0.10.0 - 29.09.2021](https://github.com/jedie/PyInventory/compare/v0.9.4...v0.10.0)
|
|
253
|
+
* Group item: default "automatic" mode and can be disabled by filter action
|
|
254
|
+
* [v0.9.4 - 15.09.2021](https://github.com/jedie/PyInventory/compare/v0.9.3...v0.9.4)
|
|
255
|
+
* Pin `psycopg < 2.9` because of [https://github.com/psycopg/psycopg2/issues/1293](https://github.com/psycopg/psycopg2/issues/1293)
|
|
256
|
+
* [v0.9.3 - 15.09.2021](https://github.com/jedie/PyInventory/compare/v0.9.2...v0.9.3)
|
|
257
|
+
* Optimize "items" changelist queries
|
|
258
|
+
* Update requirements
|
|
259
|
+
* Expand `run_testserver` command and recognize address and port argument
|
|
260
|
+
* [v0.9.2 - 11.05.2021](https://github.com/jedie/PyInventory/compare/v0.9.1...v0.9.2)
|
|
261
|
+
* Update requirements
|
|
262
|
+
* [Fix error handling if item link is broken](https://github.com/jedie/PyInventory/issues/50)
|
|
263
|
+
* [v0.9.1 - 28.04.2021](https://github.com/jedie/PyInventory/compare/v0.9.0...v0.9.1)
|
|
264
|
+
* NEW: Besides images, it's now possible to add file(s) to items, too.
|
|
265
|
+
* Add a auto login if Django dev. server is used.
|
|
266
|
+
* [v0.9.0 - 11.04.2021](https://github.com/jedie/PyInventory/compare/v0.8.4...v0.9.0)
|
|
267
|
+
* Use [https://github.com/jedie/dev-shell](https://github.com/jedie/dev-shell) for development
|
|
268
|
+
* [v0.8.4 - 19.01.2021](https://github.com/jedie/PyInventory/compare/v0.8.3...v0.8.4)
|
|
269
|
+
* Search items in change list by "kind" and "tags", too
|
|
270
|
+
* update requirements
|
|
271
|
+
* [v0.8.3 - 29.12.2020](https://github.com/jedie/PyInventory/compare/v0.8.2...v0.8.3)
|
|
272
|
+
* update requirements
|
|
273
|
+
* remove colorama from direct dependencies
|
|
274
|
+
* Small project setup changes
|
|
275
|
+
* [v0.8.2 - 20.12.2020](https://github.com/jedie/PyInventory/compare/v0.8.1...v0.8.2)
|
|
276
|
+
* Bugfix [#33](https://github.com/jedie/PyInventory/issues/33): Upload images to new created Items
|
|
277
|
+
* [v0.8.1 - 09.12.2020](https://github.com/jedie/PyInventory/compare/v0.8.0...v0.8.1)
|
|
278
|
+
* Fix migration: Don't create "/media/migrate.log" if there is nothing to migrate
|
|
279
|
+
* Fix admin redirect by using the url pattern name
|
|
280
|
+
* YunoHost app package created
|
|
281
|
+
* update requirements
|
|
282
|
+
* [v0.8.0 - 06.12.2020](https://github.com/jedie/PyInventory/compare/v0.7.0...v0.8.0)
|
|
283
|
+
* Outsource the "MEDIA file serve" part into [django.tools.serve_media_app](https://github.com/jedie/django-tools/tree/master/django_tools/serve_media_app#readme)
|
|
284
|
+
* [v0.7.0 - 23.11.2020](https://github.com/jedie/PyInventory/compare/v0.6.0...v0.7.0)
|
|
285
|
+
* Change deployment setup:
|
|
286
|
+
* Replace uwsgi with gunicorn
|
|
287
|
+
* make deploy setup more generic by renaming "inventory" to "django"
|
|
288
|
+
* Bugfix MEDIA path: store the files on a docker volumes
|
|
289
|
+
* run app server as normal user and not root
|
|
290
|
+
* pull all docker images before build
|
|
291
|
+
* [v0.6.0 - 15.11.2020](https://github.com/jedie/PyInventory/compare/v0.5.0...v0.6.0)
|
|
292
|
+
* User can store images to every item: The image can only be accessed by the same user.
|
|
293
|
+
* [v0.5.0 - 14.11.2020](https://github.com/jedie/PyInventory/compare/v0.4.2...v0.5.0)
|
|
294
|
+
* Merge separate git branches into one: "/src/" and "/development/" [#19](https://github.com/jedie/PyInventory/issues/19)
|
|
295
|
+
* [v0.4.2 - 13.11.2020](https://github.com/jedie/PyInventory/compare/v0.4.1...v0.4.2)
|
|
296
|
+
* Serve static files by Caddy
|
|
297
|
+
* Setup CKEditor file uploads: Store files into random sub directory
|
|
298
|
+
* reduce CKEditor plugins
|
|
299
|
+
* [v0.4.1 - 2.11.2020](https://github.com/jedie/PyInventory/compare/v0.4.0...v0.4.1)
|
|
300
|
+
* Small bugfixes
|
|
301
|
+
* [v0.4.0 - 1.11.2020](https://github.com/jedie/PyInventory/compare/v0.3.2...v0.4.0)
|
|
302
|
+
* Move docker stuff and production use information into separate git branch
|
|
303
|
+
* Add django-axes: keeping track of suspicious logins and brute-force attack blocking
|
|
304
|
+
* Add django-processinfo: collect information about the running server processes
|
|
305
|
+
* [v0.3.2 - 26.10.2020](https://github.com/jedie/PyInventory/compare/v0.3.0...v0.3.2)
|
|
306
|
+
* Bugfix missing translations
|
|
307
|
+
* [v0.3.0 - 26.10.2020](https://github.com/jedie/PyInventory/compare/v0.2.0...v0.3.0)
|
|
308
|
+
* setup production usage:
|
|
309
|
+
* Use [caddy server](https://caddyserver.com/) as reverse proxy
|
|
310
|
+
* Use uWSGI as application server
|
|
311
|
+
* autogenerate `secret.txt` file for `settings.SECRET_KEY`
|
|
312
|
+
* Fix settings
|
|
313
|
+
* split settings for local development and production use
|
|
314
|
+
* Bugfix init: move "setup user group" from checks into "post migrate" signal handler
|
|
315
|
+
* Bugfix for using manage commands `dumpdata` and `loaddata`
|
|
316
|
+
* [v0.2.0 - 24.10.2020](https://github.com/jedie/PyInventory/compare/v0.1.0...v0.2.0)
|
|
317
|
+
* Simplify item change list by nested item
|
|
318
|
+
* Activate Django-Import/Export
|
|
319
|
+
* Implement multi user usage
|
|
320
|
+
* Add Django-dbbackup
|
|
321
|
+
* Add docker-compose usage
|
|
322
|
+
* [v0.1.0 - 17.10.2020](https://github.com/jedie/PyInventory/compare/v0.0.1...v0.1.0)
|
|
323
|
+
* Enhance models, admin and finish project setup
|
|
324
|
+
* v0.0.1 - 14.10.2020
|
|
325
|
+
* Just create a pre-alpha release to save the PyPi package name ;)
|
|
326
|
+
|
|
327
|
+
## links
|
|
328
|
+
|
|
329
|
+
| | |
|
|
330
|
+
|----------|--------------------------------------------------------------------------------|
|
|
331
|
+
| Homepage | [http://github.com/jedie/PyInventory](http://github.com/jedie/PyInventory) |
|
|
332
|
+
| PyPi | [https://pypi.org/project/PyInventory/](https://pypi.org/project/PyInventory/) |
|
|
333
|
+
|
|
334
|
+
Discuss here:
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
* [vogons.org Forum Thread (en)](https://www.vogons.org/viewtopic.php?f=5&t=77285)
|
|
338
|
+
* [Python-Forum (de)](https://www.python-forum.de/viewtopic.php?f=9&t=50024)
|
|
339
|
+
* [VzEkC e. V. Forum Thread (de)](https://forum.classic-computing.de/forum/index.php?thread/21738-opensource-projekt-pyinventory-web-basierte-verwaltung-um-seine-dinge-zu-katalog/)
|
|
340
|
+
* [dosreloaded.de Forum Thread (de)](https://dosreloaded.de/forum/index.php?thread/3702-pyinventory-retro-sammlung-katalogisieren/)
|
|
341
|
+
|
|
342
|
+
## donation
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
* [paypal.me/JensDiemer](https://www.paypal.me/JensDiemer)
|
|
346
|
+
* [Flattr This!](https://flattr.com/submit/auto?uid=jedie&url=https%3A%2F%2Fgithub.com%2Fjedie%2FPyInventory%2F)
|
|
347
|
+
* Send [Bitcoins](http://www.bitcoin.org/) to [1823RZ5Md1Q2X5aSXRC5LRPcYdveCiVX6F](https://blockexplorer.com/address/1823RZ5Md1Q2X5aSXRC5LRPcYdveCiVX6F)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
inventory/__init__.py,sha256=Iv4Ft_BtKXxs0Ce8g7OuWWATObW4-qDHPVDacCXRLqQ,242
|
|
2
|
+
inventory/apps.py,sha256=68p_QyUdd0kKArJHQeMprerwPLmR0uZKFxrx7za-T-A,492
|
|
3
|
+
inventory/ckeditor_upload.py,sha256=1dyUoE8Mnf1b7jBoaWsd2g3OpmQPntcpD8VaWyZPge0,391
|
|
4
|
+
inventory/context_processors.py,sha256=nYRQngXmC5YAy_qoc8mmflDbg56CShLxP1ika2PAWRE,134
|
|
5
|
+
inventory/forms.py,sha256=qljPTlj5DYhxqIOY7sZTkfRPb3snN9MYEdvGcZpiboQ,1204
|
|
6
|
+
inventory/middlewares.py,sha256=lSENqnsNFgBg96nwhCe1Nade5QYput4KtOhs-6JQRuE,530
|
|
7
|
+
inventory/parent_tree.py,sha256=C2xy8IJ5Emkym6Ho6HSuNvqYKgrS01ZGUIlPhnkeW7o,1939
|
|
8
|
+
inventory/permissions.py,sha256=V9gTaeNjAi6kSsSlULMavk_ONpe7ZrZfPQ7XW-tuXxI,1482
|
|
9
|
+
inventory/request_dict.py,sha256=W_g5X7OWtVaDSER6mmRRd8Qx1bpSfqDjylHEpx0c-CU,288
|
|
10
|
+
inventory/signals.py,sha256=qAgZ4u_-QXvRQmwmS4m4P9reyshswAmW9dEOZcMRjcA,537
|
|
11
|
+
inventory/string_utils.py,sha256=d-0a90LybAwG3qnac3lf99FFzKytsRjeH_FVN9NuRIA,482
|
|
12
|
+
inventory/admin/__init__.py,sha256=53tSjECw7s8EIYVq_jmeFTmBFFjMpH9_l4CDVUjV0Lk,176
|
|
13
|
+
inventory/admin/base.py,sha256=Ac18iLirP_8vP0D35W1Mch636ZaPPPCsm8KCkBvoH6E,3130
|
|
14
|
+
inventory/admin/item.py,sha256=kzrQKWX9kVX1mx_LI2S5VVKofKIlbFflGz3y5xB1g5Y,5275
|
|
15
|
+
inventory/admin/location.py,sha256=MzG7bAyEOsYal61LN-EURtSeLUD4SLv3I1HU1B2lQQk,2638
|
|
16
|
+
inventory/admin/memo.py,sha256=9liL2Av8ngJ_rnqsICzAh8roGSe1KyZdnWharVB6SLM,2241
|
|
17
|
+
inventory/admin/tagulous_fix.py,sha256=vsvu3lW_GY-MS_z_RFviPSvxds_bgCLxWdcH3hDNEKg,1359
|
|
18
|
+
inventory/locale/ca/LC_MESSAGES/django.mo,sha256=t6s_0hoRA5ou8pNoj7wqVPsZFn38yV_OqCMjg6OJoNw,5292
|
|
19
|
+
inventory/locale/ca/LC_MESSAGES/django.po,sha256=a2b6vePhEc97WXZmNFivBzxL-OcCAlWlmb7lGObSQTM,5596
|
|
20
|
+
inventory/locale/de/LC_MESSAGES/django.mo,sha256=k_jk5xTnu31fpjcT7fanWlysPzQXTVYiiz2m_SzB-Q8,6268
|
|
21
|
+
inventory/locale/de/LC_MESSAGES/django.po,sha256=s_XO5SkzClpHv9oEaavGi5JhKQQ3bpNoyOU2fTeB0rA,6224
|
|
22
|
+
inventory/locale/en/LC_MESSAGES/django.mo,sha256=4Y31m85CpkwkCeecFIRdm8OjNBOQvi754SmQIL0zoww,5026
|
|
23
|
+
inventory/locale/en/LC_MESSAGES/django.po,sha256=h4V4bESet5sqpTpyO92My3SQ583peWOtkUBzeBXhBBY,5475
|
|
24
|
+
inventory/locale/es/LC_MESSAGES/django.mo,sha256=ADmXJj6NvWkYkWESsquyEPOh4cwdzwobmJxNsyrhEs8,5367
|
|
25
|
+
inventory/locale/es/LC_MESSAGES/django.po,sha256=WlWF9BoRihL_szM6b5KIRczEQRHVoiKxosaG12BfXPM,5671
|
|
26
|
+
inventory/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
+
inventory/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
inventory/management/commands/seed_data.py,sha256=mZT5w0Sue_ByykqpZ6NAtu9_m4kDCaRLUKkl-9rNIJA,4797
|
|
29
|
+
inventory/management/commands/tree.py,sha256=XsCA_nrNIqoAvG6pQObHCPGojknWBMLk4CNbm5djwDk,2100
|
|
30
|
+
inventory/migrations/0001_initial.py,sha256=ts5mEPLLAypyEFYVrPSfKW2omaCC5-GrBU_BuE7vBpw,24063
|
|
31
|
+
inventory/migrations/0002_auto_20201017_2211.py,sha256=VpTH8xHU6Npha1pralsekJdPynWfg6DbQJO33_ct5hk,2993
|
|
32
|
+
inventory/migrations/0003_auto_20201024_1830.py,sha256=BO-e-ftezUUPhp22-C3weZJblEe40CjLTJhSCqSJFDI,646
|
|
33
|
+
inventory/migrations/0004_item_user_images.py,sha256=a4HmBEqF_5iQ8oT06NQNwIgo4_2Lh132ocrGs3Mw15M,4981
|
|
34
|
+
inventory/migrations/0005_serve_uploads_by_django_tools.py,sha256=W2EUV4nTvOHr5b2QKuMl67uvAbXUIPRQP7-auBFOa3c,2106
|
|
35
|
+
inventory/migrations/0006_refactor_image_model.py,sha256=9iNPhzTyDHQT2oOsKUaQ6tIYvjXTSe1NrcRs4f7tR0E,1634
|
|
36
|
+
inventory/migrations/0007_add_file_attachment.py,sha256=jNGl3-5SCdMzgtkPTLQeGM1AkEJgVxRnwvu-IqiEG-k,5017
|
|
37
|
+
inventory/migrations/0008_last_check_datetime.py,sha256=e4S3901U72E1CQ6S9Xzcbznyv3O7iHQKHGxftX7rnos,593
|
|
38
|
+
inventory/migrations/0009_add_memo.py,sha256=DrigdJq5fDKDT54rUHnbEdueot8cZLsDN1gHz9ANmXQ,21153
|
|
39
|
+
inventory/migrations/0010_version_protect_models.py,sha256=qU7JcY4GflZmqbulu919Q9CY1uhrVeH2KYp2vwOhZwM,1302
|
|
40
|
+
inventory/migrations/0011_parent_tree1.py,sha256=pMUw9SJJzHXEbwouBqJtxOaxkDIIC6SgF0sUb-OHMhw,3469
|
|
41
|
+
inventory/migrations/0012_parent_tree2.py,sha256=E-oTNVIGSRIZGNP3JxCmX4mTm_srxpuOrQdifinjAfc,568
|
|
42
|
+
inventory/migrations/0013_alter_itemmodel_location.py,sha256=0GFvmt1tiGUrXHdN4TxscyPvty97_2SuEVcZkuJ3EvQ,744
|
|
43
|
+
inventory/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
+
inventory/models/__init__.py,sha256=c7II5R10rxz8_A1q8lnEfF0pCcHM0UkUvBGWchFK-m8,256
|
|
45
|
+
inventory/models/base.py,sha256=MO4V47dMdD58sswSeytZrSjJ6PfUy-y530Hf9x4jtDk,6914
|
|
46
|
+
inventory/models/item.py,sha256=ooSNJJsKa4eSihu15iL_zyb5ZatDGzPhdrao-jrnBsI,7098
|
|
47
|
+
inventory/models/links.py,sha256=L0wwf2DSDoFyZhqCF--nGPtIyaTCk9np7YY5uLmee7Y,3188
|
|
48
|
+
inventory/models/location.py,sha256=KbOQ53bX4zMEQX-ry3vhhOPvGjaYfNXLYXK5QM9EYRE,795
|
|
49
|
+
inventory/models/memo.py,sha256=r9P3PpaTJblpIfPV4b1BSN97PWmm0mI4yGWyMt4L3jk,3225
|
|
50
|
+
inventory/templates/admin/item/related_items.html,sha256=U8Bw3V7EoGU6xC3jiKo4FZTG9dO3ZCnKR_FAebpJ5FQ,381
|
|
51
|
+
inventory/templates/admin/location/items.html,sha256=U8Bw3V7EoGU6xC3jiKo4FZTG9dO3ZCnKR_FAebpJ5FQ,381
|
|
52
|
+
inventory/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
+
inventory/tests/test_admin_location.py,sha256=hNEMYPrOE97trsYTO9tkuHhYvB9GvvT9As_4LRvD5Dk,1443
|
|
54
|
+
inventory/tests/test_admin_location_empty_change_list_1.snapshot.html,sha256=7h8V5FXSwSCj_fJtNjenuQTVLl1l0o3Ez00gyQip5p4,1856
|
|
55
|
+
inventory/tests/test_item_images.py,sha256=LQXQNQvy1OIdBMc90gFRqAe7ayu6OZhdnwzhpVUOWwM,3538
|
|
56
|
+
inventory/tests/test_link_model.py,sha256=WWYO-Md99deaKZUosNtf6pzeGnS1oXzdhUpNXsBy5n8,3116
|
|
57
|
+
inventory/tests/test_management_command_seed_data.py,sha256=VVy1FVA-XgnUBCyMY3mLUPXsWxvVp3A35IZjULno2U4,2459
|
|
58
|
+
inventory/tests/test_management_command_tree.py,sha256=_wwWtdeyIDqd5mfKTywKiyIsUU-NaCFKMnuwQ0-RF4Y,892
|
|
59
|
+
inventory/tests/test_parent_tree.py,sha256=ETY9qDv2dG-WshhnBMgW73otYcRJ0E_A2EszOWgg_rw,1092
|
|
60
|
+
inventory/tests/test_parent_tree_model.py,sha256=oIrxG_3u2BGK68qYuai_64EuqmxLhT4fPYwnYuGYNT0,5330
|
|
61
|
+
inventory/tests/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
|
+
inventory/tests/fixtures/users.py,sha256=yFAYaYc6P-Fj_K-EoXw1uPa9EQMj-UFv5DmHq5sAHaU,452
|
|
63
|
+
inventory_project/__init__.py,sha256=tNhZJfFTzZz99JYUagE0D3R7_buw-Dz9PrkCfDxDpJQ,223
|
|
64
|
+
inventory_project/__main__.py,sha256=Lgl5r9csfwynJxYVUM-jHt_hfagGSyWU_y0Z0Cn0PIA,402
|
|
65
|
+
inventory_project/manage.py,sha256=c1Dt-Yr0OADhOnaDeDFlhb6C4_wf_y6kgVP1dBUQWZ4,1209
|
|
66
|
+
inventory_project/middlewares.py,sha256=zeKMaU6jdd29aTG1H15JXgcBl1LIvGMzyGuKkyoojKs,534
|
|
67
|
+
inventory_project/publish.py,sha256=nKENb3wI9lVPnyg4HCPppxTUV_QxJkGQ2iDG1jHFUSk,579
|
|
68
|
+
inventory_project/urls.py,sha256=5xbXkXLZA67PD6ZpN12n7KUYYCQamvjo7Bz9q7vaRLw,678
|
|
69
|
+
inventory_project/wsgi.py,sha256=7D-1lpbmkWdM3vLPcaRr7xZjn2fRhqMwrGh0e0yuBxc,115
|
|
70
|
+
inventory_project/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
|
+
inventory_project/settings/local.py,sha256=1Tr3fTXH5azIgGqjAFi5Qdp2lnLpXMeBsoEykvjKKb8,2380
|
|
72
|
+
inventory_project/settings/prod.py,sha256=2sydu9gxI4v4M0xEOqIaEiXuit5E7hwME5gA3Z6GrE8,13267
|
|
73
|
+
inventory_project/settings/tests.py,sha256=1LIcvNvw9TbzyddDvAIdr52rulgIwnw9GRuYFR3kY6o,1338
|
|
74
|
+
inventory_project/templates/admin/base_site.html,sha256=elpq0lXDb-wos7fEQSlyQOqUhejxlppvaGID6logJpU,715
|
|
75
|
+
inventory_project/templates/admin/login.html,sha256=oLvMiviaODmex4zolNM2E4_Bh_kOJHtcm17Aezsdzl0,1062
|
|
76
|
+
inventory_project/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
|
+
inventory_project/tests/fixtures.py,sha256=VjYcPLb6NXuZ7u_l2GAdzapItcqDZQ0RbXQxggOeVfI,1128
|
|
78
|
+
inventory_project/tests/mocks.py,sha256=3qlSLmn-_yGM1MLLLZTPQQrbkIUkS7lOPlrZvkHTHN0,387
|
|
79
|
+
inventory_project/tests/playwright_utils.py,sha256=BtS7kh2qXgV3Q5i8lziIK1hncYQwVb9rkDn8RoevEA0,699
|
|
80
|
+
inventory_project/tests/test_admin.py,sha256=vQuUZjF4GqdIr7bvMf4ThGTQaOC9wu-ZM5rnzEiymOE,598
|
|
81
|
+
inventory_project/tests/test_admin_item.py,sha256=pZ6v0-EEn_A3cQRndStdkKGniPTinVUHMAHIj09irus,10042
|
|
82
|
+
inventory_project/tests/test_admin_item_auto_group_items_1.snapshot.html,sha256=QzsWInrpQYCUobuSCgfrSE7MzVnZ3iYy5F_237gO9Eg,10251
|
|
83
|
+
inventory_project/tests/test_admin_item_auto_group_items_2.snapshot.html,sha256=n00Sa00b7spi6fTu9wNCosNXJA2HUn_9B9dLGJpflvc,6133
|
|
84
|
+
inventory_project/tests/test_admin_item_login_1.snapshot.html,sha256=RVw3PCC3Gbh9dRmO4Sh__cTHiAKcRNXff8aS24AQkPw,1176
|
|
85
|
+
inventory_project/tests/test_admin_item_normal_user_create_minimal_item_1.snapshot.html,sha256=oXMaztAdZfJ46bY3R6vOuAbw981rnnHBUFTqA1u7SGs,27911
|
|
86
|
+
inventory_project/tests/test_admin_item_normal_user_create_minimal_item_2.snapshot.html,sha256=WbyQ9zM-N0W5yrMA8EPTspGcFl3HyDhfxn9OYUgdwqk,40697
|
|
87
|
+
inventory_project/tests/test_admin_memo.py,sha256=3yvylm5xHQDcVkX_o4y0PjMNavcdDTTqwX2CjKFw6Uo,6943
|
|
88
|
+
inventory_project/tests/test_admin_memo_normal_user_create_minimal_item_1.snapshot.html,sha256=AW4x1JLvlAUsVQ9XWo0IiG0q0NAm74-aYuVmBksRSko,17016
|
|
89
|
+
inventory_project/tests/test_command_shell_help_django4.2.3.snapshot.txt,sha256=qtaRIu8ehJj8iPAz2pteK-WzOWw0iTUUBYmZVfkJ-rI,1327
|
|
90
|
+
inventory_project/tests/test_inventory_commands.py,sha256=3Zkum0mU7FcBDF4cJMen7SA5eiS3r9WJg7aGjT-75uI,942
|
|
91
|
+
inventory_project/tests/test_migrations.py,sha256=qwHP93EcLqfrdPMjTNan3svqB55NBx9M_YBMYkk_8Iw,637
|
|
92
|
+
inventory_project/tests/test_models_item.py,sha256=2RTGgfWcc20szkvpxxxydU2MZerVxwIxLXdWffL9Idg,956
|
|
93
|
+
inventory_project/tests/test_playwright_admin.py,sha256=f147dv8UyHq7d985yVBt_IRKEkE9jQ9-BrycIiFeB2Q,7268
|
|
94
|
+
inventory_project/tests/test_project_setup.py,sha256=_DJDD6uy54tGgDMpvWqO32a2EuZ-WqTLWXrnjvHEWzE,3933
|
|
95
|
+
PyInventory-0.19.0.dist-info/AUTHORS,sha256=RJVibz0ziobYzwPggogluebJECjpO4yH2OLSX65KdQg,455
|
|
96
|
+
PyInventory-0.19.0.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
|
97
|
+
PyInventory-0.19.0.dist-info/METADATA,sha256=fJqHew5Imdv1yjlRXDfrvg-o2-lUhLADIWFhz_HE41s,16546
|
|
98
|
+
PyInventory-0.19.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
99
|
+
PyInventory-0.19.0.dist-info/entry_points.txt,sha256=EpSDTYJx4GtgAL3lFrAD_SPe3iMvns8fcWbsKSssVK4,70
|
|
100
|
+
PyInventory-0.19.0.dist-info/top_level.txt,sha256=OTVhV3K-yyiROj7LUicl6MbJIQCI1AK3SpPNwzgrl-M,28
|
|
101
|
+
PyInventory-0.19.0.dist-info/RECORD,,
|
inventory/__init__.py
ADDED
inventory/admin/base.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from adminsortable2.admin import SortableInlineAdminMixin
|
|
2
|
+
from django.contrib import admin
|
|
3
|
+
from django.utils.html import format_html
|
|
4
|
+
from django.utils.translation import gettext_lazy as _
|
|
5
|
+
from reversion_compare.admin import CompareVersionAdmin
|
|
6
|
+
|
|
7
|
+
from inventory.forms import OnlyUserRelationsModelForm
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class UserInlineMixin:
|
|
11
|
+
def get_queryset(self, request):
|
|
12
|
+
qs = super().get_queryset(request)
|
|
13
|
+
|
|
14
|
+
if not request.user.is_superuser:
|
|
15
|
+
# Display only own created entries
|
|
16
|
+
qs = qs.filter(user=request.user)
|
|
17
|
+
|
|
18
|
+
return qs
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class BaseUserAdmin(CompareVersionAdmin):
|
|
22
|
+
form = OnlyUserRelationsModelForm
|
|
23
|
+
|
|
24
|
+
def get_changelist(self, request, **kwargs):
|
|
25
|
+
self.request = request
|
|
26
|
+
self.user = request.user
|
|
27
|
+
return super().get_changelist(request, **kwargs)
|
|
28
|
+
|
|
29
|
+
def save_model(self, request, obj, form, change):
|
|
30
|
+
if obj.user_id is None:
|
|
31
|
+
obj.user = request.user
|
|
32
|
+
|
|
33
|
+
super().save_model(request, obj, form, change)
|
|
34
|
+
|
|
35
|
+
def get_queryset(self, request):
|
|
36
|
+
qs = super().get_queryset(request)
|
|
37
|
+
qs = qs.select_related(
|
|
38
|
+
'user',
|
|
39
|
+
)
|
|
40
|
+
if not request.user.is_superuser:
|
|
41
|
+
# Display only own created entries
|
|
42
|
+
qs = qs.filter(user=request.user)
|
|
43
|
+
|
|
44
|
+
return qs
|
|
45
|
+
|
|
46
|
+
def get_list_filter(self, request):
|
|
47
|
+
list_filter = self.list_filter
|
|
48
|
+
|
|
49
|
+
if request.user.is_superuser:
|
|
50
|
+
# Superuser sees entries from all users -> Add "By user" filter
|
|
51
|
+
list_filter = list(list_filter)
|
|
52
|
+
list_filter.insert(0, 'user')
|
|
53
|
+
|
|
54
|
+
return list_filter
|
|
55
|
+
|
|
56
|
+
def get_list_display(self, request):
|
|
57
|
+
list_display = self.list_display
|
|
58
|
+
|
|
59
|
+
if request.user.is_superuser:
|
|
60
|
+
# Superuser sees entries from all users -> Display the user in change list
|
|
61
|
+
list_display = list(list_display)
|
|
62
|
+
list_display.insert(0, 'user')
|
|
63
|
+
|
|
64
|
+
return list_display
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class BaseImageModelInline(UserInlineMixin, SortableInlineAdminMixin, admin.TabularInline):
|
|
68
|
+
def preview(self, instance):
|
|
69
|
+
return format_html(
|
|
70
|
+
(
|
|
71
|
+
'<a href="{url}" title="{name}"'
|
|
72
|
+
' target="_blank" class="image_file_input_preview">'
|
|
73
|
+
'<img style="width:9em;" src="{url}"></a>'
|
|
74
|
+
),
|
|
75
|
+
url=instance.image.url,
|
|
76
|
+
name=instance.name,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
extra = 0
|
|
80
|
+
fields = ('position', 'preview', 'image', 'name', 'tags')
|
|
81
|
+
readonly_fields = ('preview',)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class BaseFileModelInline(UserInlineMixin, SortableInlineAdminMixin, admin.TabularInline):
|
|
85
|
+
extra = 0
|
|
86
|
+
fields = ('position', 'file', 'name', 'tags')
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class LimitTreeDepthListFilter(admin.SimpleListFilter):
|
|
90
|
+
title = _('Limit tree depth')
|
|
91
|
+
parameter_name = 'level'
|
|
92
|
+
|
|
93
|
+
def lookups(self, request, model_admin):
|
|
94
|
+
return (
|
|
95
|
+
('1', _('Only root')),
|
|
96
|
+
('2', _('Root + first sub')),
|
|
97
|
+
('3', _('Root + first + second sub')),
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def queryset(self, request, queryset):
|
|
101
|
+
level = self.value()
|
|
102
|
+
if level:
|
|
103
|
+
level = int(level)
|
|
104
|
+
return queryset.filter(level__lte=level)
|