Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

add param to paginate #320

Open
wants to merge 3 commits into
base: 0.9
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add new param
Bahruddin El Hayat authored and Bahruddin El Hayat committed Aug 20, 2019
commit a39c8f0c4ab60eac75a3ecfa4e6d29eb1e5144cf
9 changes: 7 additions & 2 deletions orator/orm/builder.py
Original file line number Diff line number Diff line change
@@ -286,7 +286,7 @@ def lists(self, column, key=None):

results[i] = self._model.new_from_builder(fill).column

def paginate(self, per_page=None, current_page=None, columns=None):
def paginate(self, per_page=None, current_page=None, column_count=None, columns=None):
elha14 marked this conversation as resolved.
Show resolved Hide resolved
"""
Paginate the given query.

@@ -296,15 +296,20 @@ def paginate(self, per_page=None, current_page=None, columns=None):
:param current_page: The current page of results
:type current_page: int

:param column_count: The columns that used to get count
:type column_count: list

:param columns: The columns to return
:type columns: list

:return: The paginator
"""
if columns is None:
columns = ["*"]
if column_count is None:
column_count = ["*"]

total = self.to_base().get_count_for_pagination()
total = self.to_base().get_count_for_pagination(column_count)

page = current_page or Paginator.resolve_current_page()
per_page = per_page or self._model.get_per_page()