mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
[1.1.X] Fixed #13282 -- Clarified documentation around week_day filtering in querysets. Thanks to wangchun, Ramiro Morales and timo.
Backport of r13155 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13159 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
95693cc6dd
commit
d529963113
@ -1518,15 +1518,15 @@ week_day
|
|||||||
|
|
||||||
For date/datetime fields, a 'day of the week' match.
|
For date/datetime fields, a 'day of the week' match.
|
||||||
|
|
||||||
|
Takes an integer value representing the day of week from 1 (Sunday) to 7
|
||||||
|
(Saturday).
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
Entry.objects.filter(pub_date__week_day=2)
|
Entry.objects.filter(pub_date__week_day=2)
|
||||||
|
|
||||||
SQL equivalent::
|
(No equivalent SQL code fragment is included for this lookup because
|
||||||
|
implementation of the relevant query varies among different database engines.)
|
||||||
SELECT ... WHERE EXTRACT('dow' FROM pub_date) = '2';
|
|
||||||
|
|
||||||
(The exact SQL syntax varies for each database engine.)
|
|
||||||
|
|
||||||
Note this will match any record with a pub_date that falls on a Monday (day 2
|
Note this will match any record with a pub_date that falls on a Monday (day 2
|
||||||
of the week), regardless of the month or year in which it occurs. Week days
|
of the week), regardless of the month or year in which it occurs. Week days
|
||||||
|
Loading…
x
Reference in New Issue
Block a user