summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/db/models/functions/datetime.py14
-rw-r--r--django/db/models/query.py7
-rw-r--r--django/utils/timezone.py14
3 files changed, 4 insertions, 31 deletions
diff --git a/django/db/models/functions/datetime.py b/django/db/models/functions/datetime.py
index 02d92a9a07..baed94227a 100644
--- a/django/db/models/functions/datetime.py
+++ b/django/db/models/functions/datetime.py
@@ -241,18 +241,14 @@ class TruncBase(TimezoneMixin, Transform):
kind = None
tzinfo = None
- # RemovedInDjango50Warning: when the deprecation ends, remove is_dst
- # argument.
def __init__(
self,
expression,
output_field=None,
tzinfo=None,
- is_dst=timezone.NOT_PASSED,
**extra,
):
self.tzinfo = tzinfo
- self.is_dst = is_dst
super().__init__(expression, output_field=output_field, **extra)
def as_sql(self, compiler, connection):
@@ -343,7 +339,7 @@ class TruncBase(TimezoneMixin, Transform):
pass
elif value is not None:
value = value.replace(tzinfo=None)
- value = timezone.make_aware(value, self.tzinfo, is_dst=self.is_dst)
+ value = timezone.make_aware(value, self.tzinfo)
elif not connection.features.has_zoneinfo_database:
raise ValueError(
"Database returned an invalid datetime value. Are time "
@@ -360,22 +356,16 @@ class TruncBase(TimezoneMixin, Transform):
class Trunc(TruncBase):
-
- # RemovedInDjango50Warning: when the deprecation ends, remove is_dst
- # argument.
def __init__(
self,
expression,
kind,
output_field=None,
tzinfo=None,
- is_dst=timezone.NOT_PASSED,
**extra,
):
self.kind = kind
- super().__init__(
- expression, output_field=output_field, tzinfo=tzinfo, is_dst=is_dst, **extra
- )
+ super().__init__(expression, output_field=output_field, tzinfo=tzinfo, **extra)
class TruncYear(TruncBase):
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 13d24bb871..c943cfe219 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1372,11 +1372,7 @@ class QuerySet(AltersData):
.order_by(("-" if order == "DESC" else "") + "datefield")
)
- # RemovedInDjango50Warning: when the deprecation ends, remove is_dst
- # argument.
- def datetimes(
- self, field_name, kind, order="ASC", tzinfo=None, is_dst=timezone.NOT_PASSED
- ):
+ def datetimes(self, field_name, kind, order="ASC", tzinfo=None):
"""
Return a list of datetime objects representing all available
datetimes for the given field_name, scoped to 'kind'.
@@ -1400,7 +1396,6 @@ class QuerySet(AltersData):
kind,
output_field=DateTimeField(),
tzinfo=tzinfo,
- is_dst=is_dst,
),
plain_field=F(field_name),
)
diff --git a/django/utils/timezone.py b/django/utils/timezone.py
index 73813fa20e..eff91667ec 100644
--- a/django/utils/timezone.py
+++ b/django/utils/timezone.py
@@ -37,9 +37,6 @@ __all__ = [ # noqa for utc RemovedInDjango50Warning.
"make_naive",
]
-# RemovedInDjango50Warning: sentinel for deprecation of is_dst parameters.
-NOT_PASSED = object()
-
def __getattr__(name):
if name != "utc":
@@ -259,17 +256,8 @@ def is_naive(value):
return value.utcoffset() is None
-def make_aware(value, timezone=None, is_dst=NOT_PASSED):
+def make_aware(value, timezone=None):
"""Make a naive datetime.datetime in a given time zone aware."""
- if is_dst is NOT_PASSED:
- is_dst = None
- else:
- warnings.warn(
- "The is_dst argument to make_aware(), used by the Trunc() "
- "database functions and QuerySet.datetimes(), is deprecated as it "
- "has no effect with zoneinfo time zones.",
- RemovedInDjango50Warning,
- )
if timezone is None:
timezone = get_current_timezone()
# Check that we won't overwrite the timezone of an aware datetime.