title: How can django-cms plugins be displayed using pagination
body: <p>I written two django-cms plugins to display image galleries and videos.</p>
  
  <p>These are attached to CMS pages at <code>/gallery/</code> and <code>/videos/</code> where each template has a placeholder allowing the corresponding plugin to be included.</p>
  
  <p>At that base level where I have <code>gallery.html</code> and <code>video.html</code> rendering all plugin instances to the page I would like to be able to attach <code>endless</code> for pagination.</p>
  
  <p>This was a really simple task to achive pagination on images within a gallery because I have an <code>apphook</code> view in the <code>gallery</code> to collect a list of all the images and then it's as simple as <code>{% pagingate images %} {% for image in images %}</code> etc in the template.</p>
  
  <p>However in a template where django-cms controls the collection &amp; rendering of all the plugin instances and I lose that control, how can I paginate the plugins?</p>
  
  <p>I've started down a route of using an <code>apphook</code> on the <code>/gallery/</code> index, but to acomplish this I can imagine I'll need to stop django-cms doing what it does by default and what it should be left to do. So I need some guidance/advise on the best method for the job. Anyway, here's some code;</p>
  
  <pre><code># views.py
      def gallery_index(request, *args, **kwargs):
  
          template = request.current_page.template
          placeholder_id = request.current_page.placeholders.get(slot='gallery').id
  
          gallery = Placeholder.objects.get(id=placeholder_id)
          galleries = gallery.cmsplugin_set.all()
  
          return render_to_response(
              template,
              {'galleries': galleries},
              context_instance=RequestContext(request)
          )
  
  # gallery.html
      &lt;h3&gt;GALLERIES&lt;/h3&gt;
  
      &lt;div id="panel-area" class="gallery_grid"&gt;
          &lt;ul id="galleries" class="gridview" style="width: 800px;"&gt;
      {% paginate galleries %}
          {% for gallery in galleries %}
              &lt;li&gt;{{ gallery }}&lt;/li&gt; &lt;!-- testing the pagination --&gt;
          {% endfor %}
      {% placeholder "gallery" %}
          &lt;/ul&gt;
      {% show_pages %}
  
  # cms_plugins.py
      class ImageGalleryPlugin(CMSPluginBase):
  
          name = _('Image Gallery')
          model = ImageGalleryPlugin
          form = ImageGalleryAdminForm
          render_template = 'single_gallery.html'
  
          def render(self, context, instance, placeholder):
  
              context.update({'gallery': instance,})        
              return context
  
  # single_gallery.html
      &lt;li class="gallery_top"&gt;
      &lt;span class="title"&gt;
          &lt;a href="{% url 'image_gallery_page' page_id=request.current_page.id gallery_id=gallery.id %}"&gt;{{ gallery.event_date|date:"d/m/Y" }}&lt;br/&gt;
               &lt;p class="sub-text"&gt;View more of {{ gallery.event_name }}&lt;/p&gt;&lt;/a&gt;
      &lt;/span&gt;
          &lt;img src="{{ gallery.display_random.gallery_display }}" alt="" border="0" /&gt;
      &lt;/li&gt;
  </code></pre>
  
  <p>My current solution is a jQuery solution, but I'd love it all to be controlled by django endless pagination for consistency in behaviour and design.</p>