diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-03-22 03:00:12 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-03-22 03:00:12 +0000 |
| commit | 858ac0580228a4ee8ae8a8cbeb1887ae824d2ef1 (patch) | |
| tree | f314d4daeca11ea9faffc6c6083c3f9ce8193e30 | |
| parent | 29aa31d8f5dd10ed30e539bebc17735e3b4ae89c (diff) | |
Fixed #2351 -- Fixed problem with using ".count" attribute of QuerySets in
templates.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4772 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/models/query.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index 12b2ff9d31..e01905551e 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -109,6 +109,8 @@ class QuerySet(object): def __getitem__(self, k): "Retrieve an item or slice from the set of results." + if not isinstance(k, (slice, int)): + raise TypeError assert (not isinstance(k, slice) and (k >= 0)) \ or (isinstance(k, slice) and (k.start is None or k.start >= 0) and (k.stop is None or k.stop >= 0)), \ "Negative indexing is not supported." |
