Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
django-infinite-scroll
Advanced tools
Add infinite scroll to any django app.
- Allows to add infinite scroll to any page.
- Easy pagination.
- Works with Django's Queryset or any kind of lists.
- Requires no aditional javascript framework.
- Easy to install and set up.
With docker compose:
git clone https://github.com/gsteixeira/django-infinite-scroll.git
cd django-infinite-scroll/example/
docker-compose up
Go to http://localhost:8000 and try it out. 8)
Install module.
pip install django-infinite-scroll
Add to settings.py
INSTALLED_APPS = [
# ...
'infscroll',
]
First, let's make a view that will load the dynamic content:
from infscroll.views import more_items
def more(request):
# This is the list that will be paginated.
list_items = MyModel.objects.all()
return more_items(request, list_items,
# (optional) your custom template
template='more.html')
Add it to urls.py
path('more/', myapp.views.more, name='more'),
Finally, Add to the view you want to show the infinite scroll:
from infscroll.utils import get_pagination
def my_view(request):
# The list of items to be paginated. It can be any list of queryset.
list_items = MyModel.objects.all()
paginated = get_pagination(request, list_items)
# we must declare the url where it will load more stuff
data = {
'more_posts_url': reverse('more'),
}
# update with paginated info
data.update(paginated)
return render(request, 'my_view.html', data)
Now add to your template:
{% load infinite_scroll %}
<html>
<body>
<p>Hello</p>
<!-- The dynamically loaded items will show here -->
{% infinite_scroll_box %}
<!-- This can go in the end of the template. Will load css and js -->
{% set_infinite_scroll %}
</body>
</html>
Now go to the page of "my_view", and you should have infinite scroll!
Here is an example:
{% load infinite_scroll %}
{% for item in feed %}
{{ item }}
{% endfor %}
{% infinite_scroll_tags %}
Just add this for loop to iterate the list and include the scroll tags
PAGINATION_STEPS - the amount of items each step will load. Default to 10.
- python3
- django
FAQs
Adds infinite scroll to any page
We found that django-infinite-scroll demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.