From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Sat, 6 Jan 2024 05:20:38 +0000 (-0800) Subject: Replaces deprecated Django with standard library (#5262) X-Git-Tag: v2.3.0~1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37e34d92def3feb7fe8c986c7586c9f889fe74cb;p=thirdparty%2Fpaperless-ngx.git Replaces deprecated Django with standard library (#5262) --- diff --git a/src/documents/index.py b/src/documents/index.py index e4c9bcb340..90bc15e7bf 100644 --- a/src/documents/index.py +++ b/src/documents/index.py @@ -4,11 +4,12 @@ import os from collections import Counter from contextlib import contextmanager from datetime import datetime +from datetime import timezone from typing import Optional from dateutil.parser import isoparse from django.conf import settings -from django.utils import timezone +from django.utils import timezone as django_timezone from guardian.shortcuts import get_users_with_perms from whoosh import classify from whoosh import highlight @@ -370,7 +371,7 @@ class DelayedQuery: class LocalDateParser(English): def reverse_timezone_offset(self, d): - return (d.replace(tzinfo=timezone.get_current_timezone())).astimezone( + return (d.replace(tzinfo=django_timezone.get_current_timezone())).astimezone( timezone.utc, ) @@ -401,7 +402,7 @@ class DelayedFullTextQuery(DelayedQuery): ) qp.add_plugin( DateParserPlugin( - basedate=timezone.now(), + basedate=django_timezone.now(), dateparser=LocalDateParser(), ), )