Commits

Victor Kotseruba committed 0dcb4e9

callable per_page support

Comments (0)

Files changed (2)

ninjapaginator/util.py

         self.object_list = object_list
         self.style = style or getattr(settings, "PAGINATION_STYLE", "digg")
         self.style_fn = getattr(self, '%s_style' % self.style)
-        self.per_page = per_page
+        self._per_page = per_page
         self.frame_size = frame_size
         self.allow_user_per_page = allow_user_per_page
         self.paginator_name = paginator_name or '%s_paginator' % object_list
         self.template = template or 'paginator_%s.html' % self.style
         self.fixed_user_per_page = fixed_user_per_page
         self.anchor = anchor
-        
+    
+    @property
+    def per_page(self):
+        if callable(self._per_page):
+            return self._per_page()
+        return self._per_page
+    
     def __call__(self, function):
         """
         receive decorated function and return
 from setuptools import setup, find_packages
 setup(
-    name = "django-ninjapaginator",
-    version = "0.1.5",
+    name = "django-ninjapaginator-ng",
+    version = "0.1.6",
     packages = find_packages(),
     author = "Anderson",
     author_email = "self.anderson@gmail.com",
     description = "Django application with multiple type of pagination integrated",
     license = "BSD",
     keywords = "django",
-    url = "http://bitbucket.org/offline/django-ninjapaginator/wiki/",
+    url = "http://bitbucket.org/barbuza/django-ninjapaginator/",
     install_requires = ["django-annoying"],
     include_package_data = True,
     zip_safe = False