Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination dict() support #580

Closed
wants to merge 1 commit into from
Closed

Pagination dict() support #580

wants to merge 1 commit into from

Conversation

nicolashahn
Copy link

@nicolashahn nicolashahn commented Jan 9, 2018

For issue #482

Credit goes to @protream, I just implemented

Now you can do this:

>>> p = Pagination('a',1,20,100,[])
>>> dict(p)
{'page': 1, 'pages': 5, 'total': 100, 'has_prev': False, 'next_num': 2, 'has_next': True, 'items': []}
>>> p['page']
1

@rsyring
Copy link
Contributor

rsyring commented Mar 9, 2019

Is this a dup of #485?

@davidism
Copy link
Member

davidism commented Jun 2, 2019

While this is clever, Pagination is not actually dict-like, so making dict(Pagination) work is a little too magical for me.

@davidism davidism closed this Jun 2, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2020
@davidism davidism removed this from the 3.x milestone Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

3 participants