Bumps django to 4.0 and fixes associated issues

This commit is contained in:
Trenton Holmes 2022-03-22 15:46:39 -07:00
parent 71e5b5cf72
commit 78258eb9cb
6 changed files with 23 additions and 17 deletions

10
Pipfile
View File

@ -10,12 +10,12 @@ name = "piwheels"
[packages] [packages]
dateparser = "~=1.1" dateparser = "~=1.1"
django = "~=3.2" django = "~=4.0"
django-cors-headers = "*" django-cors-headers = "*"
django-extensions = "*" django-extensions = "*"
django-filter = "~=21.1" django-filter = "~=21.1"
django-q = "~=1.3.4" django-q = "~=1.3"
djangorestframework = "~=3.13.1" djangorestframework = "~=3.13"
filelock = "*" filelock = "*"
fuzzywuzzy = {extras = ["speedup"], version = "*"} fuzzywuzzy = {extras = ["speedup"], version = "*"}
gunicorn = "*" gunicorn = "*"
@ -35,8 +35,8 @@ scikit-learn="==1.0.2"
whitenoise = "~=6.0.0" whitenoise = "~=6.0.0"
watchdog = "~=2.1.0" watchdog = "~=2.1.0"
whoosh="~=2.7.4" whoosh="~=2.7.4"
inotifyrecursive = "~=0.3.4" inotifyrecursive = "~=0.3"
ocrmypdf = "~=13.4.1" ocrmypdf = "~=13.4"
tqdm = "*" tqdm = "*"
tika = "*" tika = "*"
# TODO: This will sadly also install daphne+dependencies, # TODO: This will sadly also install daphne+dependencies,

8
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "93ddbf2da13c20b786f08c205ec107c6129493dfc5c07b03fa0db00abc97257f" "sha256": "7e76d6b807f96506f56c1bddb36b44deda6745014e5ed7c94f047fc1eb972eb8"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": {}, "requires": {},
@ -280,11 +280,11 @@
}, },
"django": { "django": {
"hashes": [ "hashes": [
"sha256:9772e6935703e59e993960832d66a614cf0233a1c5123bc6224ecc6ad69e41e2", "sha256:1239218849e922033a35d2a2f777cb8bee18bd725416744074f455f34ff50d0c",
"sha256:9b06c289f9ba3a8abea16c9c9505f25107809fb933676f6c891ded270039d965" "sha256:77ff2e7050e3324c9b67e29b6707754566f58514112a9ac73310f60cd5261930"
], ],
"index": "pypi", "index": "pypi",
"version": "==3.2.12" "version": "==4.0.3"
}, },
"django-cors-headers": { "django-cors-headers": {
"hashes": [ "hashes": [

View File

@ -35,7 +35,7 @@ django-extensions==3.1.5
django-filter==21.1 django-filter==21.1
django-picklefield==3.0.1; python_version >= '3' django-picklefield==3.0.1; python_version >= '3'
django-q==1.3.9 django-q==1.3.9
django==3.2.12 django==4.0.3
djangorestframework==3.13.1 djangorestframework==3.13.1
filelock==3.6.0 filelock==3.6.0
fuzzywuzzy[speedup]==0.18.0 fuzzywuzzy[speedup]==0.18.0

View File

@ -579,13 +579,13 @@ class TestDocumentApi(DirectoriesMixin, APITestCase):
d3.tags.add(t2) d3.tags.add(t2)
d4 = Document.objects.create( d4 = Document.objects.create(
checksum="4", checksum="4",
created=timezone.datetime(2020, 7, 13), created=timezone.make_aware(datetime.datetime(2020, 7, 13)),
content="test", content="test",
) )
d4.tags.add(t2) d4.tags.add(t2)
d5 = Document.objects.create( d5 = Document.objects.create(
checksum="5", checksum="5",
added=timezone.datetime(2020, 7, 13), added=timezone.make_aware(datetime.datetime(2020, 7, 13)),
content="test", content="test",
) )
d6 = Document.objects.create(checksum="6", content="test2") d6 = Document.objects.create(checksum="6", content="test2")
@ -1897,21 +1897,21 @@ class TestBulkDownload(DirectoriesMixin, APITestCase):
filename="docA.pdf", filename="docA.pdf",
mime_type="application/pdf", mime_type="application/pdf",
checksum="B", checksum="B",
created=datetime.datetime(2021, 1, 1), created=timezone.make_aware(datetime.datetime(2021, 1, 1)),
) )
self.doc2b = Document.objects.create( self.doc2b = Document.objects.create(
title="document A", title="document A",
filename="docA2.pdf", filename="docA2.pdf",
mime_type="application/pdf", mime_type="application/pdf",
checksum="D", checksum="D",
created=datetime.datetime(2021, 1, 1), created=timezone.make_aware(datetime.datetime(2021, 1, 1)),
) )
self.doc3 = Document.objects.create( self.doc3 = Document.objects.create(
title="document B", title="document B",
filename="docB.jpg", filename="docB.jpg",
mime_type="image/jpeg", mime_type="image/jpeg",
checksum="C", checksum="C",
created=datetime.datetime(2020, 3, 21), created=timezone.make_aware(datetime.datetime(2020, 3, 21)),
archive_filename="docB.pdf", archive_filename="docB.pdf",
archive_checksum="D", archive_checksum="D",
) )

View File

@ -5,6 +5,11 @@ import tempfile
from unittest import mock from unittest import mock
from unittest.mock import MagicMock from unittest.mock import MagicMock
try:
import zoneinfo
except ImportError:
import backports.zoneinfo as zoneinfo
from django.conf import settings from django.conf import settings
from django.test import override_settings from django.test import override_settings
from django.test import TestCase from django.test import TestCase
@ -341,7 +346,7 @@ class TestConsumer(DirectoriesMixin, TestCase):
self._assert_first_last_send_progress() 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) @override_settings(PAPERLESS_FILENAME_FORMAT=None)
def testDeleteMacFiles(self): def testDeleteMacFiles(self):

View File

@ -18,6 +18,7 @@ from django.db.models.functions import Lower
from django.http import Http404 from django.http import Http404
from django.http import HttpResponse from django.http import HttpResponse
from django.http import HttpResponseBadRequest from django.http import HttpResponseBadRequest
from django.utils.decorators import method_decorator
from django.utils.translation import get_language from django.utils.translation import get_language
from django.views.decorators.cache import cache_control from django.views.decorators.cache import cache_control
from django.views.generic import TemplateView from django.views.generic import TemplateView
@ -332,7 +333,7 @@ class DocumentViewSet(
raise Http404() raise Http404()
@action(methods=["get"], detail=True) @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): def thumb(self, request, pk=None):
try: try:
doc = Document.objects.get(id=pk) doc = Document.objects.get(id=pk)