Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
How can I load specific number of items in Django and then load more items after scrolling?

I added some products with using this function in my views:

def All( request  ):
    p=product.objects.all()
    return render(request,'home.html',{'p':p})

And my template looks like this:

<div class="grid">  
  
         {%for p in p%} 
                <div class='card'>
                    <img src="{{p.image}}"></img>
                    <p id="id">{{p.description}}</p>
                    <a href="{{p.buy}}" target='_blank' rel='noopener noreferrer'>
                        <button ><span class="price"> ${{p.price}}</span> buy</button>
                    </a>    




                </div>

         {%endfor%} 

But I do not know what should I do to be able to limit the products, for example I want to have 10 products after the page is loaded and then after scrolling I want 10 more products to appear.

How can I do that?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

You need to use pagination you can read about it here in the docs

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!