my pagination is not working as i expected .

def products(request):
    product = Products_Table.objects.order_by('id')
    categories = Category.objects.all()
    tags = Product_Tags.objects.all()
    paginator = Paginator(product,3)
    page_number = 1
    if request.method == 'POST':
        data = json.loads(request.body) 
        page_number = data.get('page')
    print(page_number)
    productFinal = paginator.get_page(page_number)
    for i in productFinal:
        print(i)
    total_pages = paginator.num_pages
    context = {
        'product': productFinal, 
        'categories': categories,
        'tags': tags,
        'total_pages': total_pages,
        'curr': page_number
    }
    context.update(cart_items(request))
    return render(request,'products/productlist.html',context)

the request for getting a specific page is coming to the server with the page number gets the products and returning but in the html the products are not updating

Side note: When posting code, templates, html and error messages here, enclose that text between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted. (I’ve taken the liberty of editing your post, please remember to do this in the future.)

Since it appears that you may be using ajax to submit the new page number, I think we’re going to need to see the JavaScript making this request along with the productlist.html template.