Commits

offline  committed 61d6b80

object_list_item_name renamed to 'key'

  • Participants
  • Parent commits 58ff65a

Comments (0)

Files changed (1)

File simplepagination/__init__.py

     http://bitbucket.org/offline/django-annoying/wiki/Home
     """
 
-    def __init__(self, object_list_item_name='object_list', style=None, per_page=10, 
+    def __init__(self, key='object_list', style=None, per_page=10, 
                 frame_size=8, allow_user_per_page=False, fixed_user_per_page=None, 
                 template=None, anchor=None):
         """
         Decorator parameters 
 
-        object_list_item_name - Name of the variable with objects that we paginate.
+        key - Name of the variable with objects that we paginate.
         style - name of pagination backend.
         per_page - number of objects to show on page.
         frame_size - max pages numbers to show.
         """
 
-        self.object_list_item_name = object_list_item_name
+        self.key = key
         self.style = style or getattr(settings, "PAGINATION_STYLE", "digg")
         self.backend = get_instance_from_path(settings.PAGINATION_BACKENDS[self.style])
         self.per_page = per_page
             params.pop('per_page')
         
         try:
-            paginate_qs = output.pop(self.object_list_item_name)
+            paginate_qs = output.pop(self.key)
         except KeyError:
-            raise KeyError("Key '%s' not found in view's returned dictionary" % self.object_list_item_name)
+            raise KeyError("Key '%s' not found in view's returned dictionary" % self.key)
         paginator = Paginator(paginate_qs, per_page)
         
         try:
         data['paginator_template'] = self.template
         data['allow_user_per_page'] = self.allow_user_per_page
 
-        output[self.object_list_item_name] = page.object_list
+        output[self.key] = page.object_list
         data.update(self.backend.paginate(self.frame_size, pages, page_num))
         output['paginator'] = data