0

I am very new to Flask and pagination in general.

I need to paginate a list which is as follows:

campaign_brief_result = [
    {'id': 112233, 'name': 'DSR-335', 'description': 'Desc', 'currency': '0'},
    {'id': 11223344, 'name': 'DSR-336', 'description': 'Desc2', 'currency': '2'}
]

When I run the code below I am unable to find the items attribute. How can I access the data that is being paginated here? Here is my code snippet that i am using:

paginated_data = Pagination( page = 1,
                             per_page = 2, 
                             total = len(campaign_brief_result),
                             search = False, 
                             record_name = 'campaign_brief_result')
print(dir(paginated_data))

the print shows me the following attributes of 'paginated_data':

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_get_single_page_link', 'alignment', 'anchor', 'args', 'bs_version', 'bulma_style', 'css_end_fmt', 'css_framework', 'current_page_fmt', 'display_msg', 'endpoint', 'first_page', 'format_number', 'format_total', 'found', 'gap_marker_fmt', 'has_next', 'has_prev', 'href', 'info', 'init_values', 'inner_window', 'is_disabled', 'last_page', 'link', 'link_css_fmt', 'link_size', 'links', 'next_disabled_page_fmt', 'next_label', 'next_page', 'next_page_fmt', 'outer_window', 'page', 'page_href', 'page_parameter', 'pages', 'per_page', 'per_page_parameter', 'prev_disabled_page_fmt', 'prev_label', 'prev_page', 'prev_page_fmt', 'record_name', 'search', 'search_msg', 'show_single_page', 'single_page', 'skip', 'total', 'total_pages', 'url_coding']
Peter Moore
  • 1,632
  • 1
  • 17
  • 31
PHP_Newbie
  • 77
  • 1
  • 8

0 Answers0