mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
Replaces deprecated Django with standard library (#5262)
This commit is contained in:
parent
bd35030c59
commit
37e34d92de
@ -4,11 +4,12 @@ import os
|
|||||||
from collections import Counter
|
from collections import Counter
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from datetime import timezone
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from dateutil.parser import isoparse
|
from dateutil.parser import isoparse
|
||||||
from django.conf import settings
|
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 guardian.shortcuts import get_users_with_perms
|
||||||
from whoosh import classify
|
from whoosh import classify
|
||||||
from whoosh import highlight
|
from whoosh import highlight
|
||||||
@ -370,7 +371,7 @@ class DelayedQuery:
|
|||||||
|
|
||||||
class LocalDateParser(English):
|
class LocalDateParser(English):
|
||||||
def reverse_timezone_offset(self, d):
|
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,
|
timezone.utc,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -401,7 +402,7 @@ class DelayedFullTextQuery(DelayedQuery):
|
|||||||
)
|
)
|
||||||
qp.add_plugin(
|
qp.add_plugin(
|
||||||
DateParserPlugin(
|
DateParserPlugin(
|
||||||
basedate=timezone.now(),
|
basedate=django_timezone.now(),
|
||||||
dateparser=LocalDateParser(),
|
dateparser=LocalDateParser(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user