shtalinberg / django-el-pagination Goto Github PK
View Code? Open in Web Editor NEWDjango endless pagination tools. Ajax, multiple and lazy pagination, Twitter-style and Digg-style pagination.
License: MIT License
Django endless pagination tools. Ajax, multiple and lazy pagination, Twitter-style and Digg-style pagination.
License: MIT License
Hi.
Can I change my ajax api url to as "/ajax/data/"? hopefully, change it like fixed.
as I typed above, I would like to get some data from "/ajax/data/" url. but there was not happened.
could you let me know how can I solve this?
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.
please create pip installable package.
at least one who is very good familiar with the frontend
If you are confident in their abilities, patient and own free time - offer yourself
process parameter passed "per_page" via GET
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',
],
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>
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.
See Generic views if you use Django >= 1.3 and you want to replicate the same behavior using a
class-based generic view.
From: http://django-el-pagination.readthedocs.io/en/latest/twitter_pagination.html
Today the latest version is Django 1.9.5.
Most people use class-based-views today.
What do you think?
How to fix this?
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 ?
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
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"><</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">></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>
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.
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 ?
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!
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.
syncdb
was removed in django 1.9. Use migrate
instead.
I have a question about how django pagination works:
If I have 10 million objects in the database, returns the 10 million to "frontend" or is it asking the server bit by bit?
Thanks!
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
The private variable Paginator._num_pages
, which el-pagination relies on is removed in this commit django/django@79a0918.
Easy fix would be to add self._num_pages = None
to BasePaginator.__init__
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/
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.
You use the template name "myapp/entry_index.html"
Example: http://django-el-pagination.readthedocs.io/en/latest/twitter_pagination.html
The django docs use "myapp/entry_list.html"
Example: https://docs.djangoproject.com/en/1.9/ref/class-based-views/generic-display/#listview
It would be kind if you could follow the django naming conventions. This would make it more easy for new comers.
entry_index.html vs entry_list.html
What do you think?
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 :
{{ article.title }}
{{ article.content|truncatechars_html:80 | safe }}
Traceback:
File "D:\www\CMS\django1.9\lib\site-packages\django\core\handlers\base.py" in get_response
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
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
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
return template.render(context, request)
File "D:\www\CMS\django1.9\lib\site-packages\django\template\backends\django.py" in render
return self.template.render(context)
File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in render
return self._render(context)
File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in _render
return self.nodelist.render(context)
File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in render
bit = node.render_annotated(context)
File "D:\www\CMS\django1.9\lib\site-packages\django\template\base.py" in render_annotated
return self.render(context)
File "D:\www\CMS\django1.9\lib\site-packages\el_pagination\templatetags\el_pagination_tags.py" in render
context['request'], querystring_key, default=default_number)
File "D:\www\CMS\django1.9\lib\site-packages\django\template\context.py" in getitem
raise KeyError(key)
Exception Type: KeyError at /
Exception Value: u'request'
© Copyright 2009-2013, Oleksandr Shtalinberg and Francesco Banconi. Revision 30974dd.
From: http://django-el-pagination.readthedocs.io/en/latest/start.html
No update since three years?
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.
Can you just tell me the steps to run this project ?
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
AFAIK the following code from the docs is deprecated.
urlpatterns = patterns('',
(r'^publishers/$', ListView.as_view(model=Publisher)),
)
From http://django-el-pagination.readthedocs.org/en/latest/generic_views.html
New way: https://docs.djangoproject.com/en/1.9/topics/http/urls/#example
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
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?
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:
Why not remove the snippet from above from the docs?
Following Digg-style pagination > Adding Ajax, I get this:
url(r'^$', views.list_files(), name='list-files'),
TypeError: decorated() missing 1 required positional argument: 'request'
I'm using Django 1.9.7.
Url is defined like this: url(r'^$', views.list_files(), name='list-files'),
The rest is basically copy-pasted from the doc, with function name changed.
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' %}
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
........
{% 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 %}
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.
How can we get the show_current_number for specific pagination if we have multiple paginations in the same template ?
There is some pressure to release the fourth version of Bootstrap [1].
Are there plans to update crispy forms template to match?
Is there some current effort ongoing?
[1]http://blog.getbootstrap.com/2016/09/05/bootstrap-4-alpha-4/
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))
AjaxListView can support multiple paginations in the same page? I see doc (http://django-el-pagination.readthedocs.io/en/latest/multiple_pagination.html), but AjaxListView says nothing, only it appears for function.
I try with:
class Foo(AjaxListView): page_template = 'foo.html, foo2.html'
and
class Foo(AjaxListView): page_templates = 'foo.html, foo2.html'
Thanks.
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).
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!
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
The problem is similar with this one:
http://stackoverflow.com/questions/18490247/losing-order-of-sorted-queryset-with-django-endless-pagination
But I'm using only one pagination on the page. And use of decorator didn't help me.
Need update documentation
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.
Please provide sample templates for class based views
Thank you
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 %}
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.