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 trbs, 11 years ago)
  • django/core/paginator.py

    index 8b4d289..755a2c2 100644
    a b class Page(object):  
    9090    def __getitem__(self, index):
    9191             # The object_list is converted to a list so that if it was a QuerySet
    9292                      # it won't be a database hit per __getitem__.
    9393                      -        return list(self.object_list)[index]
    9494                      +        if isinstance(index, (int, long, slice)):
    9595                      +            return list(self.object_list)[index]
    9696                      +        return super(Page, self).__getitem__(index)
    9797                       
    9898                            # The following four methods are only necessary for Python <2.6
Back to Top