Fixed #32738 -- Deprecated django.utils.datetime_safe module.

This commit is contained in:
Nick Pope 2021-05-07 18:20:14 +01:00 committed by Carlton Gibson
parent 46346f8ea0
commit 29e4ccb1a2
4 changed files with 17 additions and 2 deletions

View File

@ -8,10 +8,18 @@
# '0010/08/02 was a Monday'
import time
import warnings
from datetime import date as real_date, datetime as real_datetime
from django.utils.deprecation import RemovedInDjango50Warning
from django.utils.regex_helper import _lazy_re_compile
warnings.warn(
'The django.utils.datetime_safe module is deprecated.',
category=RemovedInDjango50Warning,
stacklevel=2,
)
class date(real_date):
def strftime(self, fmt):

View File

@ -19,6 +19,8 @@ details on these changes.
* The undocumented ``django.utils.baseconv`` module will be removed.
* The undocumented ``django.utils.datetime_safe`` module will be removed.
.. _deprecation-removed-in-4.1:
4.1

View File

@ -437,6 +437,8 @@ Miscellaneous
* The undocumented ``django.utils.baseconv`` module is deprecated.
* The undocumented ``django.utils.datetime_safe`` module is deprecated.
Features removed in 4.0
=======================

View File

@ -1,7 +1,10 @@
from datetime import date as original_date, datetime as original_datetime
from django.test import SimpleTestCase
from django.utils.datetime_safe import date, datetime
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango50Warning
with ignore_warnings(category=RemovedInDjango50Warning):
from django.utils.datetime_safe import date, datetime
class DatetimeTests(SimpleTestCase):