Ticket #11287: 10953.patch

File 10953.patch, 636 bytes (added by QingFeng, 15 years ago)

Paginator patch

  • django/core/paginator.py

     
    118118        if self.number == self.paginator.num_pages:
    119119            return self.paginator.count
    120120        return self.number * self.paginator.per_page
     121
     122class NBPageList(object):
     123    """
     124    Better performance of the page class
     125    """
     126    def __init__(self, model):
     127        self.model = model
     128    def count(self):
     129        return self.model.count()
     130    def __getslice__(self,i,j):
     131        return self.model.all()[i:j]
Back to Top