Commits

offline committed 61d6b80

object_list_item_name renamed to 'key'

Comments (0)

Files changed (1)

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
         
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.