GithubHelp home page GithubHelp logo

shtalinberg / django-el-pagination Goto Github PK

View Code? Open in Web Editor NEW
305.0 305.0 72.0 410 KB

Django endless pagination tools. Ajax, multiple and lazy pagination, Twitter-style and Digg-style pagination.

License: MIT License

Makefile 1.42% Python 86.38% JavaScript 3.10% HTML 8.32% CSS 0.68% Shell 0.10%

django-el-pagination's People

Contributors

akileos avatar alb3rto269 avatar aropan avatar bashu avatar cclauss avatar cyriac avatar ffreitasalves avatar fuzzygrim avatar gingerjoos avatar izquierdo avatar joehybird avatar jpatel3 avatar jtikey avatar kindlycat avatar kirantambe avatar liamuk avatar lorand-arvay avatar lorddaedra avatar melkon98 avatar michelts avatar personjerry avatar shtalinberg avatar silmarillionua avatar timgates42 avatar toptalo avatar wavedocs avatar xaviermathew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-el-pagination's Issues

Encountered unknown tag 'load'

i am getting this error on template file, django.template.base.TemplateSyntaxError TemplateSyntaxError: ("Encountered unknown tag 'load'.",)

{% load el_pagination_tags %}

{% paginate entries %}
{% for entry in entries %}
     your code to show the entry
{% endfor %}
{% show_more %}

Can you please let me know what is wrong.

KeyError 'request'

KeyError at /
'request'
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.9.7
Exception Type: KeyError
Exception Value:
'request'
Exception Location: /Users/admin/Desktop/django/da/lib/python3.5/site-packages/django/template/context.py in getitem, line 77
Python Executable: /Users/admin/Desktop/django/da/bin/python3
Python Version: 3.5.1
Python Path:
['/Users/admin/Desktop/django/da/bin/blog',
'/Users/admin/Desktop/django/da/lib/python35.zip',
'/Users/admin/Desktop/django/da/lib/python3.5',
'/Users/admin/Desktop/django/da/lib/python3.5/plat-darwin',
'/Users/admin/Desktop/django/da/lib/python3.5/lib-dynload',
'/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5',
'/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin',
'/Users/admin/Desktop/django/da/lib/python3.5/site-packages']

And settings

   'OPTIONS': {
        'context_processors': [
            'django.core.context_processors.request',
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
        ],

Update multiple html sections on ajax update

I'd like to know if there's a way to update multiple sections, side by side panels in my case, with one ajax update.
The problem is I have a task with several related interactions, displayed in separate sections of the html, meaning I can't just include the page template and call it a day, if I understand correctly.

So, is there any way to update multiple sections of the html, in the same ajax update ?

In case more detail is needed, I'm using bootstrap's tabs for my tasks and the tab-pane for the interactions.
Example template:

<div class="row">
  <div class="col-md-5 task-list col-xs-12">
    <ul class="nav nav-tabs tabs-left">
      {% for task in task_list %}
      {% comment %}
      Task entry code
      {% endcomment %}
      {% endfor %}
    </ul>
  </div>
  <div class="col-md-7 col-xs-6 interaction-panel">
    <div class="row">
      <div class="col-xs-12">
        <div class="tab-content affix">
          <h4>
            Actividad:
          </h4>
          <div id="active-task-container"></div>
          {% for task in task_list %}
          <div class="tab-pane{% if forloop.first %} active{% endif %}" id="task-{{ forloop.counter }}">
            <h4>
              Interacciones para esta actividad:
            </h4>
            {% for interaction in task.interaction_set.all %}
            {% comment %}
            Interaction entry code
            {% endcomment %}
            {% endfor %}
          </div>
          {% endfor %}
        </div>
      </div>
    </div>
  </div>
</div>

Keep old application name

Hello, there.

It is good idea to keep old app name endless_pagination, because anyone can upgrade smoothly, to your version of endless_pagination. Just keep in mind what the "Pillow" guys did with the project name and structure.

Is Endless pagination really not SEO friendly ?

I have heard and read in many places that endless pagination or anything where contents are loaded using AJAX is not SEO friendly or at least not so easily. In Contrast while using this app I never came to write anything much in javascript. It just simply loads content dynamically using include tag of template isn't?. But yet somehow I was wondering even this app must be using Ajax in background so is it really not SEO friendly to use this app for endlessly loading content using twitter style pagination ?

Error : IndexError: list index out of range

Hi All,

i ve installed django-el-pagination on my anaconda env. Installation is successful but when i insert the row:
IndexError: TEMPLATES[0]['OPTIONS']['context_processors'].insert(0, 'django.core.context')

i get the error in the subject: IndexError: list index out of range.

I've python 3.5 and relative last Django version.

Could you please help me out?

Thanx valerio

Limited number of pages in pagination as show_pages show | digg-style

I am tring to use digg-style pagination and customize it with bootstrap. The problem is it returns me all number of pages. How can I show just a limited number of pages in pagination as show_pages show?

Thats what I am tried:

{% get_pages %}
        <nav aria-label="navigation">
            <ul class="pagination">
            {% if pages.paginated %}
                <li class="page-item">
                    <a class="page-link" href="{{ pages.first.path }}" aria-label="">
                        <span aria-hidden="true">First</span>
                        <span class="sr-only">First</span>
                    </a>
                </li>

                <li class="page-item">
                    <a class="page-link" href="{{ pages.previous.path }}" aria-label="">
                        <span aria-hidden="true">&lt;</span>
                        <span class="sr-only">Previous</span>
                    </a>
                </li>

                {% for page in pages %}
                    {% if page == None %}
                        <li class="page-item disabled">
                            <a class="page-link" href="#" aria-label="">
                                <span aria-hidden="true">...</span>
                                <span class="sr-only">...</span>
                            </a>
                        </li>
                    {% else %}
                        <li class="page-item {% if page.is_current %}active{% endif %}">
                            <a class="page-link" href="{{ page.path }}" aria-label="">
                                <span aria-hidden="true">{{ page.label|safe }}</span>
                                <span class="sr-only">{{ page.number }}</span>
                            </a>
                        </li>
                        {{ pages }}
                    {% endif %}
                {% endfor %}

                <li class="page-item">
                    <a class="page-link" href="{{ pages.next.path }}" aria-label="">
                        <span aria-hidden="true">&gt;</span>
                        <span class="sr-only">Next</span>
                    </a>
                </li>

                <li class="page-item">
                    <a class="page-link" href="{{ pages.last.path }}" aria-label="">
                        <span aria-hidden="true">Last</span>
                        <span class="sr-only">Last</span>
                    </a>
                </li>
            {% endif %}
            </ul>
        </nav>

Documentation: Explain what 'Digg style' and 'Twitter style' mean

I visited Digg and can't work out how it differs from Twitter's ajax endless scrolling.

Also - you say in the docs: "If Ajax pagination is not needed"

What does it even mean to have endless pagination without Ajax?

Ideally a demo would be great but failing that - screenshots for Digg/Twitter both with and without Ajax would be really illuminating.

How can we keep previous query parameters with on next page ?

I am using django-el-pagination app from last few days but I got stuck in a problem which I am unable to solve. Actually my home page has few input box, users enter their input criteria in those boxes and then I get the result. So my first page displays results correctly but onwords next page I get all the results irrespective of input criteria. That means my parameters of input text are maintained only in first page and from very next page it performs select all statements. Can somebody please flash little light ?

page_template decorator doesn't change template of ajax call

Hi. Thanks you for maintaining django-endless-pagination.
Today I applied django-el-pagination to my project, but when I decorated my view function with page_template decorator it rendered original template but extracted page template.

This is my code which I tried first.

@page_template('myapp/page_template.html')
@require_http_methods(['GET'])
def my_view(request,
                template='myapp/my_template.html',
                extra_context=None):
  # my logic
  context = {
    # original context values
  }

  if extra_context is not None:
      context.update(extra_context)

  return render_to_response(
          template, context, context_instance=RequestContext(request))

And this code is working successfully now.

@require_http_methods(['GET'])
def my_view(request,
                page_template='myapp/page_template.html',
                template='myapp/my_template.html',
                extra_context=None):
  # my logic
  context = {
    # original context values
  }

  if extra_context is not None:
      context.update(extra_context)
  if request.is_ajax():
        template = page_template
  return render_to_response(
          template, context, context_instance=RequestContext(request))

Thanks you!

Unexpected end of expression in if tag

It's my first time using this one but I can't make it to run because of this error.

File "/usr/local/lib/python3.5/site-packages/django/template/base.py", line 516, in parse
     raise self.error(token, e)
   File "/usr/local/lib/python3.5/site-packages/django/template/base.py", line 514, in parse
     compiled_result = compile_func(self, token)
   File "/usr/local/lib/python3.5/site-packages/django/template/defaulttags.py", line 1027, in do_if
     condition = TemplateIfParser(parser, bits).parse()
   File "/usr/local/lib/python3.5/site-packages/django/template/smartif.py", line 197, in parse
     retval = self.expression()
   File "/usr/local/lib/python3.5/site-packages/django/template/smartif.py", line 207, in expression
     left = t.nud(self)
   File "/usr/local/lib/python3.5/site-packages/django/template/smartif.py", line 150, in nud
     raise parser.error_class("Unexpected end of expression in if tag.")
 django.template.exceptions.TemplateSyntaxError: Unexpected end of expression in if tag.

Please help.

I think Django 1.9 Does not need {{ block.super }} in twitter style pagination

I was following documentation on readthedoc.org [This Doc] where I followed following code for endless twitter style loading.

`


1. {% block js %}
2. {{ block.super }}
3. <script src="http://code.jquery.com/jquery-latest.js"></script>
4. <script src="{{ STATIC_URL }}el-pagination/js/el-pagination.js"></script>
5. <script>
6. $.endlessPaginate({
7. paginateOnScroll: true,
8. paginateOnScrollChunkSize: 5});
9. </script>
10. {% endblock %}

`

But I always ended up getting Error:

'BlockNode' object has no attribute 'context'

but removing {{ block.super }} solved my problem.
I dont know whether behavior is same for Django < 1.9.

But still for 1.9 users I thought mentioning it here would be helpful

Javascript code apply for only N entries on first page.

I am using Twitter-style Pagination and everything works great, except for custom javascript code I wrote that applies only to the first page - applies to N entries on the first page. After scrolling down new content is loaded but js code doesn't work -apply to newly loaded entries.

entry_list_page.html

{% load el_pagination_tags %}

{% paginate 5 post_list %}
{% for post in post_list %}
    <div>{{ post.content }}</div>
    <button id="{{ post.id }}" type="button" class="post_button">Click me</button>
{% endfor %}
{% show_more %}

entry_list.html

{% block customscripts %}
    {{ block.super }}
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="{% static "js/el-pagination.js" %}"></script>
    <script>
        $.endlessPaginate({paginateOnScroll: true});
        $(document).ready(function(){
            $(".post_button").click(function(){
                alert("It works!");
            });
        });
    </script>
{% endblock customscripts %}

So in this case button clicks on the first 5 posts work. But after more posts are loaded it stop working.

<script>
        $.endlessPaginate({
            paginateOnScroll: true,
            onCompleted: function() {
                $(".post_button").click(function(){
                    alert("It works!");
                }); 
            },
        });
</script>

Also tried like that but the problem is reversed. Button does not work for the first 5 posts because they are allready loaded, but do work for all the rest.

Similar to this:
http://stackoverflow.com/questions/40959170/django-endless-pagination-apply-javascript-to-whole-html-after-show-more
https://www.reddit.com/r/django/comments/5onnbs/el_pagination_applying_javascript_to_content/

Not working in Latest Chrome on Linux and Opera.

Good day. I am using Django 1.9, Python 3 and trying to implement in blog load on scroll or endless pagination for my feed . After following your tutorial i didn't achieved endless pagination but I see more at the end of the page.

P.S. i 've deleted block super because for the sake of simplicity i am not using any base template.
Here are my screenshots. Any help is greatly appreciated.

Add {% paginate latest_article_list %} after an error

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 1.9.9
Python Version: 2.7.12
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'xadmin',
'crispy_forms',
'reversion',
'userena',
'guardian',
'easy_thumbnails',
'django.contrib.sites',
'el_pagination',
'pure_pagination',
'myapp']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template error:
In template D:\www\CMS\mycms\myapp\templates\index.html, error at line 4
request 1 :
2 : {% load el_pagination_tags %}
3 :
4 : {% paginate latest_article_list %}
5 : {% for article in latest_article_list %}
6 : {# your code to show the entry #}
7 :


8 : <a id="article_title", href=/focus/{{ .id }}>
9 :

{{ article.title }}


10 :
11 :

{{ article.content|truncatechars_html:80 | safe }}


12 :

13 : {% endfor %}
14 : {% show_pages %}

Traceback:

File "D:\www\CMS\django1.9\lib\site-packages\django\core\handlers\base.py" in get_response

  1.                 response = self.process_exception_by_middleware(e, request)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\core\handlers\base.py" in get_response

  1.                 response = wrapped_callback(request, _callback_args, *_callback_kwargs)
    

File "D:\www\CMS\mycms\myapp\views.py" in index

File "D:\www\CMS\django1.9\lib\site-packages\django\shortcuts.py" in render_to_response

  1.     content = loader.render_to_string(template_name, context, using=using)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\template\loader.py" in render_to_string

  1.     return template.render(context, request)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\template\backends\django.py" in render

  1.         return self.template.render(context)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in render

  1.                 return self._render(context)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in _render

  1.     return self.nodelist.render(context)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in render

  1.             bit = node.render_annotated(context)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in render_annotated

  1.         return self.render(context)
    

File "D:\www\CMS\django1.9\lib\site-packages\el_pagination\templatetags\el_pagination_tags.py" in render

  1.         context['request'], querystring_key, default=default_number)
    

File "D:\www\CMS\django1.9\lib\site-packages\django\template\context.py" in getitem

  1.     raise KeyError(key)
    

Exception Type: KeyError at /
Exception Value: u'request'

install not working in 1.9 1.10

Installation instructions seem to be outdated and does not work for django 1.9, 1.10
That context processor does not exist anymore, and the handling of the 'request' has changed.

Steps to run

Can you just tell me the steps to run this project ?

ZeroDivisionError, when {% paginate 0 object_list %}

Environment:


Request Method: GET
Request URL: http://localhost/en/index1/

Django Version: 1.7.10
Python Version: 2.7.11
Installed Applications:
['django.contrib.auth',
 'django.contrib.sessions',
 'django.contrib.contenttypes',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django.contrib.sites',
 'suit',
 'sigmacms.contrib.fluent_suit',
 'el_pagination',
 'django_extensions',
 'post_office',
 'authtools',
 'haystack',
 'sigmacms',
 'sigmacms.pagetypes.listnode',
 'sigmacms.pagetypes.simplepage',
 'sigmacms.pagetypes.redirectnode',
 'sigmacms.plugins.file',
 'sigmacms.plugins.picture',
 'sigmacms.plugins.googlemap',
 'sigmacms.plugins.twitterfeed',
 'sigmacms.plugins.oembeditem',
 'sigmacms.plugins.rawhtml',
 'sigmacms.plugins.teaser',
 'sigmacms.bootstrap',
 'usersettings',
 'adminplus',
 'django_wysiwyg',
 'easy_maps',
 'fluent_pages',
 'publisher',
 'any_imagefield',
 'any_urlfield',
 'mptt',
 'parler',
 'polymorphic',
 'polymorphic_tree',
 'filer',
 'easy_thumbnails',
 'fluent_contents',
 'fluent_contents.plugins.text',
 'fluent_contents.plugins.sharedcontent',
 'django.contrib.admin.apps.SimpleAdminConfig',
 'sigmacms.tests',
 'sigmacms.contrib.filerpicker',
 'sigmacms.contrib.simplesearch',
 'sigmacms.contrib.mail',
 'sigmacms.contrib.sitesettings']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'usersettings.middleware.CurrentUserSettingsMiddleware',
 'publisher.middleware.PublisherMiddleware',
 'sigmacms.middleware.CheckupMiddleware',
 'django.middleware.locale.LocaleMiddleware']


Template error:
In template /Users/bashu/Projects/django-sigma-cms/example/templates/listnode/default.html, error at line 0
   float division by zero
   1 : {% extends FLUENT_PAGES_BASE_TEMPLATE %}


   2 : 


   3 : {% load el_pagination_tags %}


   4 : 


   5 : {% block meta_description %}{{ page.description }}{% endblock %}


   6 : {% block meta_keywords %}{{ page.keywords }}{% endblock %}


   7 : 


   8 : {% block head_title %}{{ page.title }}{% endblock %}


   9 : 


   10 : {% block content %}


Traceback:
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  137.                 response = response.render()
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/response.py" in render
  103.             self.content = self.rendered_content
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  80.         content = template.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  148.             return self._render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in _render
  142.         return self.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  126.         return compiled_parent._render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in _render
  142.         return self.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  126.         return compiled_parent._render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in _render
  142.         return self.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  126.         return compiled_parent._render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in _render
  142.         return self.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  527.             return self.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  527.             return self.nodelist.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/el_pagination/templatetags/el_pagination_tags.py" in render
  311.             page = paginator.page(page_number)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/el_pagination/paginators.py" in page
  58.         number = self.validate_number(number)
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/django/core/paginator.py" in validate_number
  39.         if number > self.num_pages:
File "/Users/bashu/.virtualenvs/sigmacms/lib/python2.7/site-packages/el_pagination/paginators.py" in _get_num_pages
  74.                 self._num_pages = int(ceil(hits / float(self.per_page))) + 1

Exception Type: ZeroDivisionError at /en/index1/
Exception Value: float division by zero

Generated rel="page" is an error in html5 validator

The text being

Bad value page for attribute rel on element a: The string page is not a registered keyword.

<a href="?page=2"↩    rel="page"↩    class="endless_page_link">2</a>

Syntax of list of link-type keywords:
A whitespace-separated list of link types, with no duplicate keywords in the list.
Each link type must be listed as allowed on and in the HTML specification,
or must be listed as allowed on and on the Microformats wiki.
You can register link types on the Microformats wiki yourself.

I'm using a local version with html5validator but it can also be checked on http://validator.w3.org/

django-el-pagination==2.1.1

Twitter Style Pagination Really Working?

Thanks for building this app. After setting up and following steps in the doc, Twitter style pagination is not working.

Settings.py

EL_PAGINATION_PER_PAGE= 3

entry.html

      <div id="entr">
         {% include page_template %}
   </div>


        {% block js %}
                {{ block.super }}

               <script src="http://code.jquery.com/jquery-latest.js"></script>
               <script type="text/javascript" src="{% static 'el-pagination/js/el-pagination.js' %}"></script>
              <script>
                     $(document).ready(function(){
                            $('#entr').endlessPaginate({paginateOnScroll: true});
                      });
               </script>
              {% endblock %}

entry_page.html

                {% load el_pagination_tags %}

                 {% paginate bucs %}
                  {% for cb in bucs %}
                        //do your thing here
                      {% endfor %}

So it will show three items on the homepage and whenever I scroll it won't show the rest of the items. What am I missing?

Docs: old snippet could be removed.

From http://django-el-pagination.readthedocs.io/en/latest/generic_views.html

NOTE: Django < 1.8 use this rule for urlpatterns:

from django.conf.urls.defaults import *
from django.views.generic import ListView
from books.models import Publisher

urlpatterns = patterns('',
    (r'^publishers/$', ListView.as_view(model=Publisher)),
)

I think it is useless to show the old code here:

  1. Django < 1.8 is old
  2. The code snippet is only there to show what the code looks like before transforming to AjaxListView.

Why not remove the snippet from above from the docs?

Getting current page number and total page count before get_pages

I would like to put some pagination info like "Page current_number of num_pages" before the paginate function call. Something like this:

{% load el_pagination_tags %}

Page {% show_current_number %} of {% pages|length %}
{% paginate entries %}
{% for entry in entries %}
    {# your code to show the entry #}
{% endfor %}
{% get_pages %}
{# A generic pagination navbar  #}
{% include 'pagination_widget.html' %}

Paginating on scroll is not working

Hi Oleks, I m testing the paginating on scroll but it's not working as i expect.

As per documentation:
I've added the following in my main page ricerca.html

........

{% include page_template %}

{% block js %}
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="{{ STATIC_URL }}el-pagination/js/el-pagination.js"></script>
<script>
$.endlessPaginate({
paginateOnScroll: true,
paginateOnScrollMargin: 20
});
</script>
{% endblock %}

{% endautoescape %}

I've removed from my sub_ricerca.html that is my page_template

{% load el_pagination_tags %}
{% paginate entry_list %}
{% for entry in entry_list %}
{# mycode to show the entry #}
{% endfor %}
{% show_more %}

But all the results are returned the first time i submit the form, and not "page on scroll" is executed.

Endless pagination with django-activity-stream

I'm trying to use endless pagination(Twitter style) with a custom templatetag and django-activity-stream. It works ok but it loads the entire page again along with the next results. Is it possible to use a templatetag or does it have to be within a view only? All javascript is being loaded correctly as well.

@register.simple_tag(takes_context=True)
    def get_stream(context, template='actstream/endless2.html', page_template='actstream/endless.html'):
        request = context.get('request')
        context = {
            'entries': Action.objects.all(),
            'page_template': page_template,

        }

        if request.is_ajax():
            template = page_template

        return render_to_response(
            template, context, context_instance=RequestContext(request))

Digg style pagination shows all page numbers

Digg style pagination shows all page numbers instead of 1, 2, 3 ... n-2, n-1, n.
For example if I have 100 pages, it will show all page numbers from 1 to 100.
The expected behavior is showing: 1, 2, 3 ... 98, 99, 100.
This is due to context = Context({'pages': pages}) in model PageList is being overwritten by context.update(self.context).

How do I use paginate nested variables?

Trying to implement the following:
{% load el_pagination_tags %}
{% paginate qaSet.items as questionSet %}
{% for question, answerSet in questionSet %}
...
{% endfor %}
{% show_pages %}

It gives me the following error
'dict_items' object is not subscriptable

Thanks!

Integrate <link> tags in <head> for SEO

Hi,
How to integrate <link> tags in <head> for SEO ?

Example for current page = 4 :

<head>
    <link rel="prev" href="?page=3" />
    <link rel="canonical" href="?page=4" />
    <link rel="next" href="?page=5" />
</head>

Thanks and sorry for my english

No easy way to turn off scrolling pagination

Currently, because scrolling pagination happens on a jquery .scroll handler, there is no easy way to turn off scrolling pagination once turned on.

Why is this problematic? Well, say I have two paginated querysets, each of which has a infinite-scroll, Twitter-style paginated feed. Then there is no way to turn on pagination for only one of the tab feeds at a time.

Twitter pagination: Old versions of pages appearing after first one

I'm having problems getting Twitter-style pagination working - it seems to load old versions of 'pages' after the first one.

The initial page load is fine, but when I click 'show more' the subsequent 'pages' use old versions of the template/HTML, and old versions of the items-per-page number. If I click far enough, and get to a 'page' I haven't visited before, then I get the correct, current template and items-per-page number. It's as if everything is cached somewhere, although I don't currently have any caching set up.

I'm using the local Django 1.10 development server. If I visit a page directly - i.e., go to /exhibitions/?page=2 in the browser - it uses the correct, current template.

My view:

from el_pagination.views import AjaxListView

class ExhibitionListView(AjaxListView):
    template_name = 'core/exhibition_list.html'
    page_template='core/includes/exhibitions.html'
    model = Exhibition
    ordering = 'begin_date'

My core/exhibition_list.html template:

{% include 'core/includes/exhibitions.html' %}

My core/includes/exhibitions.html template:

{% load el_pagination_tags %}

{% paginate 3,3 exhibition_list %}

{% for exhibition in exhibition_list %}
	<p>{{ exhibition.title }}</p>
{% endfor %}

{% show_more %}

{% include page_template with parameters %}

It looks like you can't use the with statement when including the page_template in order to use AJAX. It gives VariableDoesNotExist error when making the AJAX call for another page.

Failed building wheel for django-el-pagination

Collecting django-el-pagination
  Downloading django-el-pagination-2.1.1.tar.gz (66kB)
    100% |████████████████████████████████| 69kB 372kB/s
Requirement already satisfied (use --upgrade to upgrade): django>=1.4.0 in /Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages (from django-el-pagination)
Building wheels for collected packages: django-el-pagination
  Running setup.py bdist_wheel for django-el-pagination
  Complete output from command /Users/bashu/.virtualenvs/demo/bin/python -c "import setuptools;__file__='/private/var/folders/Xe/XeGoWV6IHaOrxd+aEKCB-U+++TM/-Tmp-/pip-build-SJVx9J/django-el-pagination/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/Xe/XeGoWV6IHaOrxd+aEKCB-U+++TM/-Tmp-/tmpNwlNrypip-wheel-:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/Xe/XeGoWV6IHaOrxd+aEKCB-U+++TM/-Tmp-/pip-build-SJVx9J/django-el-pagination/setup.py", line 83, in <module>
      install_requires=install_requires,
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 137, in setup
      ok = dist.parse_command_line()
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/setuptools/dist.py", line 299, in parse_command_line
      result = _Distribution.parse_command_line(self)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 467, in parse_command_line
      args = self._parse_command_opts(parser, args)
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/setuptools/dist.py", line 609, in _parse_command_opts
      nargs = _Distribution._parse_command_opts(self, parser, args)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 523, in _parse_command_opts
      cmd_class = self.get_command_class(command)
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/setuptools/dist.py", line 429, in get_command_class
      ep.require(installer=self.fetch_build_egg)
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2217, in require
      reqs = self.dist.requires(self.extras)
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2462, in requires
      dm = self._dep_map
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2686, in _dep_map
      self.__dep_map = self._compute_dependencies()
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2696, in _compute_dependencies
      current_req = packaging.requirements.Requirement(req)
    File "/Users/bashu/.virtualenvs/demo/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
      requirement_string[e.loc:e.loc + 8]))
  pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'; sys.pl'"

  ----------------------------------------
  Failed building wheel for django-el-pagination
Failed to build django-el-pagination
Installing collected packages: django-el-pagination
  Running setup.py install for django-el-pagination
Successfully installed django-el-pagination-2.1.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.