Ticket #19261: django_ticket_19261_django_core_paginator_page_getitem.patch
File django_ticket_19261_django_core_paginator_page_getitem.patch, 838 bytes (added by , 11 years ago) |
---|
-
django/core/paginator.py
index 8b4d289..755a2c2 100644
a b class Page(object): 90 90 def __getitem__(self, index): 91 91 # The object_list is converted to a list so that if it was a QuerySet 92 92 # it won't be a database hit per __getitem__. 93 93 - return list(self.object_list)[index] 94 94 + if isinstance(index, (int, long, slice)): 95 95 + return list(self.object_list)[index] 96 96 + return super(Page, self).__getitem__(index) 97 97 98 98 # The following four methods are only necessary for Python <2.6