Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2351 -- Fixed problem with using ".count" attribute of QuerySe…

…ts in

templates.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4772 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 858ac0580228a4ee8ae8a8cbeb1887ae824d2ef1 1 parent 29aa31d
Malcolm Tredinnick authored March 22, 2007

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  django/db/models/query.py
2  django/db/models/query.py
@@ -109,6 +109,8 @@ def __iter__(self):
109 109
 
110 110
     def __getitem__(self, k):
111 111
         "Retrieve an item or slice from the set of results."
  112
+        if not isinstance(k, (slice, int)):
  113
+            raise TypeError
112 114
         assert (not isinstance(k, slice) and (k >= 0)) \
113 115
             or (isinstance(k, slice) and (k.start is None or k.start >= 0) and (k.stop is None or k.stop >= 0)), \
114 116
             "Negative indexing is not supported."

0 notes on commit 858ac05

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