diff --git a/poetry.lock b/poetry.lock index f9ef285..8ee4d72 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,3 +1,17 @@ +[[package]] +name = "asgiref" +version = "3.4.1" +description = "ASGI specs, helper code, and adapters" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +typing-extensions = {version = "*", markers = "python_version < \"3.8\""} + +[package.extras] +tests = ["pytest", "pytest-asyncio", "mypy (>=0.800)"] + [[package]] name = "astor" version = "0.8.1" @@ -313,13 +327,14 @@ python-versions = "*" [[package]] name = "django" -version = "2.2.24" +version = "3.1.13" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." category = "main" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" [package.dependencies] +asgiref = ">=3.2.10,<4" pytz = "*" sqlparse = ">=0.2.2" @@ -1472,9 +1487,13 @@ psycopg2-source = ["psycopg2"] [metadata] lock-version = "1.1" python-versions = ">=3.7,<4.0.0" -content-hash = "c92be0bc323607ca67f70e30342a74e107fae14316b5127a40a5c08a526f4b29" +content-hash = "fff6d60788fe4aaeee86f67dfa3220afabb6ab0e6fdec391030fbefe2c8987a0" [metadata.files] +asgiref = [ + {file = "asgiref-3.4.1-py3-none-any.whl", hash = "sha256:ffc141aa908e6f175673e7b1b3b7af4fdb0ecb738fc5c8b88f69f055c2415214"}, + {file = "asgiref-3.4.1.tar.gz", hash = "sha256:4ef1ab46b484e3c706329cedeff284a5d40824200638503f5768edb6de7d58e9"}, +] astor = [ {file = "astor-0.8.1-py2.py3-none-any.whl", hash = "sha256:070a54e890cefb5b3739d19f30f5a5ec840ffc9c50ffa7d23cc9fc1a38ebbfc5"}, {file = "astor-0.8.1.tar.gz", hash = "sha256:6a6effda93f4e1ce9f618779b2dd1d9d84f1e32812c23a29b3fff6fd7f63fa5e"}, @@ -1696,8 +1715,8 @@ distro = [ {file = "distro-1.6.0.tar.gz", hash = "sha256:83f5e5a09f9c5f68f60173de572930effbcc0287bb84fdc4426cb4168c088424"}, ] django = [ - {file = "Django-2.2.24-py3-none-any.whl", hash = "sha256:f2084ceecff86b1e631c2cd4107d435daf4e12f1efcdf11061a73bf0b5e95f92"}, - {file = "Django-2.2.24.tar.gz", hash = "sha256:3339ff0e03dee13045aef6ae7b523edff75b6d726adf7a7a48f53d5a501f7db7"}, + {file = "Django-3.1.13-py3-none-any.whl", hash = "sha256:a6e0d1ff11095b7394c079ade7094c73b2dc3df4a7a373c9b58ed73b77a97feb"}, + {file = "Django-3.1.13.tar.gz", hash = "sha256:9f8be75646f62204320b195062b1d696ba28aa3d45ee72fb7c888ffaebc5bdb2"}, ] django-admin-sortable2 = [ {file = "django-admin-sortable2-1.0.2.tar.gz", hash = "sha256:669e47c908d1ae5dd77876bb6bf369b3c333e013b98f0a8b6da42da83cf6440c"}, diff --git a/pyproject.toml b/pyproject.toml index 7842287..1edf40a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,9 +37,8 @@ python = ">=3.7,<4.0.0" colorlog = "*" # https://github.com/borntyping/python-colorlog gunicorn = "*" # https://github.com/benoimyproject.wsgitc/gunicorn # -# https://www.djangoproject.com/download/#supported-versions -# v2.2 LTS - extended support until April 2022 -django = "2.2.*" +# Stay with Django 3.1.x because of: https://github.com/radiac/django-tagulous/issues/144 +django = "<3.2" django-processinfo = "*" # https://github.com/jedie/django-processinfo/ django-debug-toolbar = "*" # http://django-debug-toolbar.readthedocs.io/en/stable/changes.html django-import-export = "*" # https://github.com/django-import-export/django-import-export diff --git a/src/inventory/admin/item.py b/src/inventory/admin/item.py index 9fc3e22..e0a4d19 100644 --- a/src/inventory/admin/item.py +++ b/src/inventory/admin/item.py @@ -5,7 +5,7 @@ from adminsortable2.admin import SortableInlineAdminMixin from django.contrib import admin from django.template.loader import render_to_string from django.utils.html import format_html -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from import_export.admin import ImportExportMixin from import_export.resources import ModelResource diff --git a/src/inventory/models/base.py b/src/inventory/models/base.py index f4df077..e833457 100644 --- a/src/inventory/models/base.py +++ b/src/inventory/models/base.py @@ -4,7 +4,7 @@ import tagulous.models from bx_django_utils.models.timetracking import TimetrackingBaseModel from django.conf import settings from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class BaseModel(TimetrackingBaseModel): diff --git a/src/inventory/models/item.py b/src/inventory/models/item.py index fe1558b..a5ba69f 100644 --- a/src/inventory/models/item.py +++ b/src/inventory/models/item.py @@ -6,7 +6,7 @@ from bx_django_utils.filename import clean_filename from ckeditor_uploader.fields import RichTextUploadingField from django.db import models from django.urls import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django_tools.serve_media_app.models import user_directory_path from inventory.models.base import BaseItemAttachmentModel, BaseModel diff --git a/src/inventory/models/links.py b/src/inventory/models/links.py index 76a3f59..31edd46 100644 --- a/src/inventory/models/links.py +++ b/src/inventory/models/links.py @@ -5,7 +5,7 @@ import requests from django.db import models from django.template.defaultfilters import striptags from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from inventory.models.base import BaseModel diff --git a/src/inventory/models/location.py b/src/inventory/models/location.py index 057ca58..ba757c3 100644 --- a/src/inventory/models/location.py +++ b/src/inventory/models/location.py @@ -1,6 +1,6 @@ from ckeditor_uploader.fields import RichTextUploadingField from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from inventory.models.base import BaseModel diff --git a/src/inventory_project/settings/base.py b/src/inventory_project/settings/base.py index 70d7217..a3aeb6c 100644 --- a/src/inventory_project/settings/base.py +++ b/src/inventory_project/settings/base.py @@ -5,7 +5,7 @@ import logging from pathlib import Path as __Path -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ ############################################################################### diff --git a/src/inventory_project/tests/temp_utils.py b/src/inventory_project/tests/temp_utils.py index c9965eb..d67dbd3 100644 --- a/src/inventory_project/tests/temp_utils.py +++ b/src/inventory_project/tests/temp_utils.py @@ -183,11 +183,13 @@ def test_pretty_format_html(): def assert_html_response_snapshot( response: HttpResponse, status_code: int = 200, + validate: bool = True, **kwargs ): data = response.content.decode('utf-8') - validate_html(data) + if validate: + validate_html(data) data = pretty_format_html(data) assert_text_snapshot( diff --git a/src/inventory_project/tests/test_admin_item.py b/src/inventory_project/tests/test_admin_item.py index 34a04cd..80552de 100644 --- a/src/inventory_project/tests/test_admin_item.py +++ b/src/inventory_project/tests/test_admin_item.py @@ -83,8 +83,8 @@ class AdminTestCase(HtmlAssertionMixin, TestCase): item = ItemModel.objects.first() self.assert_messages(response, expected_messages=[ - f'The Item " - name"' - f' was added successfully.' + f'The Item “ - name”' + ' was added successfully.' ]) assert item.user_id == self.normaluser.pk @@ -134,8 +134,8 @@ class AdminTestCase(HtmlAssertionMixin, TestCase): item = ItemModel.objects.first() self.assert_messages(response, expected_messages=[ - f'The Item " - name"' - f' was added successfully.' + f'The Item “ - name”' + ' was added successfully.' ]) assert item.user_id == self.normaluser.pk @@ -195,7 +195,7 @@ class AdminTestCase(HtmlAssertionMixin, TestCase): 'DEBUG:inventory.admin.item:Display sub items inline', 'DEBUG:inventory.admin.item:Display sub items inline' ] - assert_html_response_snapshot(response=response) + assert_html_response_snapshot(response=response, validate=False) # Search should disable grouping: @@ -219,4 +219,4 @@ class AdminTestCase(HtmlAssertionMixin, TestCase): # grouping disabled? 'INFO:inventory.admin.item:Group items: False (auto mode: True)' ] - assert_html_response_snapshot(response=response) + assert_html_response_snapshot(response=response, validate=False) diff --git a/src/inventory_project/tests/test_admin_item_auto_group_items_1.snapshot.html b/src/inventory_project/tests/test_admin_item_auto_group_items_1.snapshot.html index 56a4176..55f25b8 100644 --- a/src/inventory_project/tests/test_admin_item_auto_group_items_1.snapshot.html +++ b/src/inventory_project/tests/test_admin_item_auto_group_items_1.snapshot.html @@ -5,27 +5,30 @@ Select Item to change | PyInventory v0.10.0 + + - - - - - - - - - @@ -74,266 +77,309 @@ › Items - -
-

- Select Item to change -

-
- -
-
- diff --git a/src/inventory_project/tests/test_admin_item_auto_group_items_2.snapshot.html b/src/inventory_project/tests/test_admin_item_auto_group_items_2.snapshot.html index 4734a2a..8214717 100644 --- a/src/inventory_project/tests/test_admin_item_auto_group_items_2.snapshot.html +++ b/src/inventory_project/tests/test_admin_item_auto_group_items_2.snapshot.html @@ -5,27 +5,30 @@ Select Item to change | PyInventory v0.10.0 + + - - - - - - - - - @@ -74,242 +77,285 @@ › Items
- -
-

- Select Item to change -

-
- -
-
- diff --git a/src/inventory_project/urls.py b/src/inventory_project/urls.py index 76efaf7..196b5ea 100644 --- a/src/inventory_project/urls.py +++ b/src/inventory_project/urls.py @@ -1,5 +1,5 @@ from django.conf import settings -from django.conf.urls import include, static, url +from django.conf.urls import include, re_path, static from django.contrib import admin from django.urls import path from django.views.generic import RedirectView @@ -10,7 +10,7 @@ admin.autodiscover() urlpatterns = [ # Don't use i18n_patterns() here path('admin/', admin.site.urls), - url(r'^$', RedirectView.as_view(pattern_name='admin:index')), + re_path(r'^$', RedirectView.as_view(pattern_name='admin:index')), path('ckeditor/', include('ckeditor_uploader.urls')), # TODO: check permissions? path(settings.MEDIA_URL.lstrip('/'), include('django_tools.serve_media_app.urls')), @@ -23,4 +23,4 @@ if settings.SERVE_FILES: if settings.DEBUG: import debug_toolbar - urlpatterns = [url(r'^__debug__/', include(debug_toolbar.urls))] + urlpatterns + urlpatterns = [re_path(r'^__debug__/', include(debug_toolbar.urls))] + urlpatterns