Fixed #32738 -- Deprecated django.utils.datetime_safe module.
This commit is contained in:
parent
46346f8ea0
commit
29e4ccb1a2
|
@ -8,10 +8,18 @@
|
||||||
# '0010/08/02 was a Monday'
|
# '0010/08/02 was a Monday'
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
import warnings
|
||||||
from datetime import date as real_date, datetime as real_datetime
|
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
|
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):
|
class date(real_date):
|
||||||
def strftime(self, fmt):
|
def strftime(self, fmt):
|
||||||
|
|
|
@ -19,6 +19,8 @@ details on these changes.
|
||||||
|
|
||||||
* The undocumented ``django.utils.baseconv`` module will be removed.
|
* The undocumented ``django.utils.baseconv`` module will be removed.
|
||||||
|
|
||||||
|
* The undocumented ``django.utils.datetime_safe`` module will be removed.
|
||||||
|
|
||||||
.. _deprecation-removed-in-4.1:
|
.. _deprecation-removed-in-4.1:
|
||||||
|
|
||||||
4.1
|
4.1
|
||||||
|
|
|
@ -437,6 +437,8 @@ Miscellaneous
|
||||||
|
|
||||||
* The undocumented ``django.utils.baseconv`` module is deprecated.
|
* The undocumented ``django.utils.baseconv`` module is deprecated.
|
||||||
|
|
||||||
|
* The undocumented ``django.utils.datetime_safe`` module is deprecated.
|
||||||
|
|
||||||
Features removed in 4.0
|
Features removed in 4.0
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
from datetime import date as original_date, datetime as original_datetime
|
from datetime import date as original_date, datetime as original_datetime
|
||||||
|
|
||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase, ignore_warnings
|
||||||
from django.utils.datetime_safe import date, datetime
|
from django.utils.deprecation import RemovedInDjango50Warning
|
||||||
|
|
||||||
|
with ignore_warnings(category=RemovedInDjango50Warning):
|
||||||
|
from django.utils.datetime_safe import date, datetime
|
||||||
|
|
||||||
|
|
||||||
class DatetimeTests(SimpleTestCase):
|
class DatetimeTests(SimpleTestCase):
|
||||||
|
|
Loading…
Reference in New Issue