A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Bumps django to 4.0 and fixes associated issues
Trenton Holmes78258eb9cb24
diff --git a/Pipfile b/Pipfileindex 9854e5c9f..7cbd65b55 100644--- a/Pipfile+++ b/Pipfile@@ -10,12 +10,12 @@ name = "piwheels"[packages]dateparser = "~=1.1"-django = "~=3.2"+django = "~=4.0"django-cors-headers = "*"django-extensions = "*"django-filter = "~=21.1"-django-q = "~=1.3.4"-djangorestframework = "~=3.13.1"+django-q = "~=1.3"+djangorestframework = "~=3.13"filelock = "*"fuzzywuzzy = {extras = ["speedup"], version = "*"}gunicorn = "*"@@ -35,8 +35,8 @@ scikit-learn="==1.0.2"whitenoise = "~=6.0.0"watchdog = "~=2.1.0"whoosh="~=2.7.4"-inotifyrecursive = "~=0.3.4"-ocrmypdf = "~=13.4.1"+inotifyrecursive = "~=0.3"+ocrmypdf = "~=13.4"tqdm = "*"tika = "*"# TODO: This will sadly also install daphne+dependencies,diff --git a/Pipfile.lock b/Pipfile.lockindex 9f93ef0f1..8d0b9cfc0 100644--- a/Pipfile.lock+++ b/Pipfile.lock@@ -1,7 +1,7 @@{"_meta": {"hash": {- "sha256": "93ddbf2da13c20b786f08c205ec107c6129493dfc5c07b03fa0db00abc97257f"+ "sha256": "7e76d6b807f96506f56c1bddb36b44deda6745014e5ed7c94f047fc1eb972eb8"},"pipfile-spec": 6,"requires": {},@@ -280,11 +280,11 @@},"django": {"hashes": [- "sha256:9772e6935703e59e993960832d66a614cf0233a1c5123bc6224ecc6ad69e41e2",- "sha256:9b06c289f9ba3a8abea16c9c9505f25107809fb933676f6c891ded270039d965"+ "sha256:1239218849e922033a35d2a2f777cb8bee18bd725416744074f455f34ff50d0c",+ "sha256:77ff2e7050e3324c9b67e29b6707754566f58514112a9ac73310f60cd5261930"],"index": "pypi",- "version": "==3.2.12"+ "version": "==4.0.3"},"django-cors-headers": {"hashes": [diff --git a/requirements.txt b/requirements.txtindex 3c3a6ab0d..365d2d1a3 100644--- a/requirements.txt+++ b/requirements.txt@@ -35,7 +35,7 @@ django-extensions==3.1.5django-filter==21.1django-picklefield==3.0.1; python_version >= '3'django-q==1.3.9-django==3.2.12+django==4.0.3djangorestframework==3.13.1filelock==3.6.0fuzzywuzzy[speedup]==0.18.0diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.pyindex ecfa84046..9c43f174a 100644--- a/src/documents/tests/test_api.py+++ b/src/documents/tests/test_api.py@@ -579,13 +579,13 @@ class TestDocumentApi(DirectoriesMixin, APITestCase):d3.tags.add(t2)d4 = Document.objects.create(checksum="4",- created=timezone.datetime(2020, 7, 13),+ created=timezone.make_aware(datetime.datetime(2020, 7, 13)),content="test",)d4.tags.add(t2)d5 = Document.objects.create(checksum="5",- added=timezone.datetime(2020, 7, 13),+ added=timezone.make_aware(datetime.datetime(2020, 7, 13)),content="test",)d6 = Document.objects.create(checksum="6", content="test2")@@ -1897,21 +1897,21 @@ class TestBulkDownload(DirectoriesMixin, APITestCase):filename="docA.pdf",mime_type="application/pdf",checksum="B",- created=datetime.datetime(2021, 1, 1),+ created=timezone.make_aware(datetime.datetime(2021, 1, 1)),)self.doc2b = Document.objects.create(title="document A",filename="docA2.pdf",mime_type="application/pdf",checksum="D",- created=datetime.datetime(2021, 1, 1),+ created=timezone.make_aware(datetime.datetime(2021, 1, 1)),)self.doc3 = Document.objects.create(title="document B",filename="docB.jpg",mime_type="image/jpeg",checksum="C",- created=datetime.datetime(2020, 3, 21),+ created=timezone.make_aware(datetime.datetime(2020, 3, 21)),archive_filename="docB.pdf",archive_checksum="D",)diff --git a/src/documents/tests/test_consumer.py b/src/documents/tests/test_consumer.pyindex 27d65d4a4..af54255e0 100644--- a/src/documents/tests/test_consumer.py+++ b/src/documents/tests/test_consumer.py@@ -5,6 +5,11 @@ import tempfilefrom unittest import mockfrom unittest.mock import MagicMock+try:+ import zoneinfo+except ImportError:+ import backports.zoneinfo as zoneinfo+from django.conf import settingsfrom django.test import override_settingsfrom django.test import TestCase@@ -341,7 +346,7 @@ class TestConsumer(DirectoriesMixin, TestCase):self._assert_first_last_send_progress()- self.assertEqual(document.created.tzinfo.zone, "America/Chicago")+ self.assertEqual(document.created.tzinfo, zoneinfo.ZoneInfo("America/Chicago"))@override_settings(PAPERLESS_FILENAME_FORMAT=None)def testDeleteMacFiles(self):diff --git a/src/documents/views.py b/src/documents/views.pyindex b8814ab81..0564e5469 100644--- a/src/documents/views.py+++ b/src/documents/views.py@@ -18,6 +18,7 @@ from django.db.models.functions import Lowerfrom django.http import Http404from django.http import HttpResponsefrom django.http import HttpResponseBadRequest+from django.utils.decorators import method_decoratorfrom django.utils.translation import get_languagefrom django.views.decorators.cache import cache_controlfrom django.views.generic import TemplateView@@ -332,7 +333,7 @@ class DocumentViewSet(raise Http404()@action(methods=["get"], detail=True)- @cache_control(public=False, max_age=315360000)+ @method_decorator(cache_control(public=False, max_age=315360000))def thumb(self, request, pk=None):try:doc = Document.objects.get(id=pk)