1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

magic-removal: Cleaned up get_in_bulk() and __get_date_list() DB queries to match documentation and improve error checking.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2006-01-09 14:34:17 +00:00
parent dde6963869
commit 0389e6261b
3 changed files with 28 additions and 17 deletions

View File

@@ -180,6 +180,17 @@ False
>>> Article.objects.get_pub_date_list('day', order='DESC')
[datetime.datetime(2005, 7, 31, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), datetime.datetime(2005, 7, 28, 0, 0)]
# Try some bad arguments to __get_date_list
>>> Article.objects.get_pub_date_list('badarg')
Traceback (most recent call last):
...
AssertionError: 'kind' must be one of 'year', 'month' or 'day'.
>>> Article.objects.get_pub_date_list(order='ASC')
Traceback (most recent call last):
...
TypeError: __get_date_list() takes at least 3 non-keyword arguments (2 given)
# An Article instance doesn't have access to the "objects" attribute.
# That is only available as a class method.
>>> a7.objects.get_list()