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
added as_dict method for Pagination class #485
Conversation
I'm worried about returning |
I've fixed code style but i don't know what to do with items. Just remove it from dictionary? |
@kalombos if items always have to be properly parsed (meaning set again in the dictionary), then it probably makes sense to not have it in the output of to_dict. Example:
This syntax would also be quite nice:
|
@@ -403,6 +403,17 @@ def iter_pages(self, left_edge=2, left_current=2, | |||
yield num | |||
last = num | |||
|
|||
def as_dict(self): | |||
"""Create a dict with the pagination fields for use as a JSON response.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to mention that the result of this will probably not be directly JSON serializable. To serialize query results and models, the dev will need to implement a custom Flask.json_encoder
class.
Hi, thanks for working on this! Based on further discussion in #482, I no longer think this is a feature we want to support right now, so I'm going to close it. |
#482