summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2015-03-07 13:20:29 -0800
committerTim Graham <timograham@gmail.com>2015-06-02 08:49:10 -0400
commit44f3ee77166bd5c0e8a4604f2d96015268dce100 (patch)
tree733d47ee8d00d3934ae86d8b26275ad4fde4d371 /docs
parent076a63e672370ff1735e7942cd1ae0990bcbd263 (diff)
Fixed #9596 -- Added date transform for DateTimeField.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/querysets.txt21
-rw-r--r--docs/releases/1.9.txt6
2 files changed, 27 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 0ad944fe3a..0a0749d0c9 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -2463,6 +2463,27 @@ numbers and even characters.
Generally speaking, you can't mix dates and datetimes.
+.. fieldlookup:: date
+
+date
+~~~~
+
+.. versionadded:: 1.9
+
+For datetime fields, casts the value as date. Allows chaining additional field
+lookups. Takes a date value.
+
+Example::
+
+ Entry.objects.filter(pub_date__date=datetime.date(2005, 1, 1))
+ Entry.objects.filter(pub_date__date__gt=datetime.date(2005, 1, 1))
+
+(No equivalent SQL code fragment is included for this lookup because
+implementation of the relevant query varies among different database engines.)
+
+When :setting:`USE_TZ` is ``True``, fields are converted to the current time
+zone before filtering.
+
.. fieldlookup:: year
year
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt
index 71960c5c3b..72e7fce2dc 100644
--- a/docs/releases/1.9.txt
+++ b/docs/releases/1.9.txt
@@ -233,6 +233,9 @@ Models
:class:`~django.db.models.Avg` aggregate in order to aggregate over
non-numeric columns, such as ``DurationField``.
+* Added the :lookup:`date` lookup to :class:`~django.db.models.DateTimeField`
+ to allow querying the field by only the date portion.
+
CSRF
^^^^
@@ -346,6 +349,9 @@ Database backend API
``adapt_<type>field_value()`` to mirror the ``convert_<type>field_value()``
methods.
+* To use the new ``date`` lookup, third-party database backends may need to
+ implement the ``DatabaseOperations.datetime_cast_date_sql()`` method.
+
Default settings that were tuples are now lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~