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

Could the BuildableListView work with pagination? #59

Open
palewire opened this issue Aug 19, 2014 · 4 comments
Open

Could the BuildableListView work with pagination? #59

palewire opened this issue Aug 19, 2014 · 4 comments
Labels

Comments

@palewire
Copy link
Owner

No description provided.

@steve-kasica
Copy link

I looked into pagination today, and I've put some ideas about how it could be implemented in a pagination branch.

Paginating results with BuildableListView seems like low-hanging fruit because that functionality is built right into the MultipleObjectMixin. However, the user has to specify the page parameter inside the URLconf instead of as a GET request parameter, e.g. /objects/page1 instead of /objects/?page=1.

I was able to bake these pages by overriding build_method. If an instance of BuildableListView has a valid paginate_by member, then the Paginator class determines how the queryset should be partitioned. For each page of data, it modifies build_path and the value of page_kwarg before calling the super build_method to build the page as usual.

Example App ran smoothly with runserver and when I started serving the .build with http-server. But, the paginating links in the template didn't work when I ran the projecton buildserver.

@palewire, what are your thoughts?

@steve-kasica
Copy link

I took another look at this issue, and I refactored my POC from April against the latest code changes in this commit. The most significant difference is using reverse to assign build_path, which is nice because then a build_path member isn't a required attribute. I'm ready to create a pull request. But, I'm curious about how you'd want to implement these changes.

Do you see this kind of enhancement directly modifying the build_queryset method of BuildableListView or should it be included a mixin, like how BuildableTemplateView supports JSON responses?

@palewire
Copy link
Owner Author

Thanks for this. I'll give it a look when I have some time. I've experimented with using reverse myself so I like this direction, though I haven't given it a close look yet.

@palewire
Copy link
Owner Author

palewire commented Dec 5, 2018

@swkasica I'm still open to this patch if you ever have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants