From addd3df3bd39730cd82c52d9726c9b7dbf1bdb8f Mon Sep 17 00:00:00 2001 From: Karen Tracey Date: Sun, 8 Feb 2009 05:08:06 +0000 Subject: Fixed #7672 -- Added a 'week_day' lookup type. Many thanks to Ross Poulton for the proposal and implementation on all built-in database backends.. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9818 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/models/querysets.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'docs') diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 1e32552570..d8d01467b9 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1344,6 +1344,27 @@ SQL equivalent:: Note this will match any record with a pub_date on the third day of the month, such as January 3, July 3, etc. +week_day +~~~~~~~~ + +.. versionadded:: 1.1 + +For date/datetime fields, a 'day of the week' match. + +Example:: + + Entry.objects.filter(pub_date__week_day=2) + +SQL equivalent:: + + 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 +of the week), regardless of the month or year in which it occurs. Week days +are indexed with day 1 being Sunday and day 7 being Saturday. + isnull ~~~~~~ -- cgit v1.3