J
J
Jek2020-10-22 04:54:01
Flask
Jek, 2020-10-22 04:54:01

How to do page flipping in flask?

how do i do this page flip?
5f90e3272b58b804162599.png

in my web application, at the request of the user, the site is parsed and a list of links is sent, the list is very large and does not fit on the page. In general, how to place a paging on an html page to break one large list of 1000 links into small ones of 50?
and what is this block called in bootstrap?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
ge, 2020-10-22
@gedev

To begin with, it would be nice to break this list into those very pages of 50.
If the list of links is passed as a list (meaning the data type), then you can do this:

def paginate(links: list, items_per_page: int) -> list:
    """
    Эта функция разделяет список links на страницы по
    items_per_page элементов на страницу. Возвращает список из списков.
    Пример: 
    """
    pages = []
    i = 0
    j = 0
    while i <= (len(links) - 1):
        while j <= (len(links) - 1):
            j = j + items_per_page
            pages.append((links[i:j]))
            i = i + items_per_page
    return pages

Have you opened the Bootstrap docs ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question