mtre...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed 02336cd

Fixed #2351 -- Fixed problem with using ".count" attribute of QuerySets in

  • Participants
  • Parent commits 0ab7259
  • Branches default

Comments (0)

Files changed (1)

File django/db/models/

     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."