Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added model unit tests for get_DATEFIELD_list(). Refs #1423

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2449 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 85f084de39d03df2152661bb3b070623c88daeca 1 parent 3daf7bd
@adrianholovaty adrianholovaty authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 tests/testapp/models/lookup.py
View
9 tests/testapp/models/lookup.py
@@ -127,6 +127,15 @@ def __repr__(self):
>>> a2.get_previous_by_pub_date()
Article 1
+# Every DateField and DateTimeField give their model module a get_FOO_list
+# function.
+>>> articles.get_pub_date_list('year')
+[datetime.datetime(2005, 1, 1, 0, 0)]
+>>> articles.get_pub_date_list('month')
+[datetime.datetime(2005, 7, 1, 0, 0), datetime.datetime(2005, 8, 1, 0, 0)]
+>>> articles.get_pub_date_list('day')
+[datetime.datetime(2005, 7, 26, 0, 0), datetime.datetime(2005, 7, 27, 0, 0), datetime.datetime(2005, 7, 28, 0, 0), datetime.datetime(2005, 8, 1, 0, 0)]
+
# Underscores and percent signs have special meaning in the underlying
# database library, but Django handles the quoting of them automatically.
>>> a8 = articles.Article(headline='Article_ with underscore', pub_date=datetime(2005, 11, 20))

0 comments on commit 85f084d

Please sign in to comment.
Something went wrong with that request. Please try again.