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

Add operator to limit result count #56

Open
jbanning-oreilly opened this issue Apr 15, 2020 · 1 comment
Open

Add operator to limit result count #56

jbanning-oreilly opened this issue Apr 15, 2020 · 1 comment

Comments

@jbanning-oreilly
Copy link

Currently the limits for query results are set by Django admin pagination, with the option to "select all" across the pages when performing an action on the results. Some actions have limits of their own, so the "select all" group is too big, but the default pagination size of 100 results means having to manually loop through select 100, apply action, select next 100, [...] until the action has been applied to the full set.

Could a djangoql operator be added which can set a limit on the number of returned rows? Something exactly like the SQL "LIMIT" would be ideal.

Thanks!

@stebunovd
Copy link
Member

Hi @jbanning-oreilly,

thank you for the idea, and I understand the use case and problem that you're facing. I'm not sure that it would be feasible to solve it with DjangoQL though. DjangoQL operates on the queryset level, and its result is a standard Django queryset. Of course, it's possible to apply slicing to a queryset, and that would probably fit into the current implementation model. However, it won't affect the way how Django does its pagination. I.e., it would shrink the resulting queryset, and you'll see fewer pages, but it won't affect the items per page setting, which is specific to Django admin.

I suppose that maybe the problem could be solved differently. There's a built-in setting in Django for items per page configuration. If you'd like it to be configurable directly from the user interface, it could be possible, I guess, and it might be a useful addition for all Django users, not just DjangoQL users. However, separate research is needed on this topic, and probably a solution will not be connected to DjangoQL.

thanks,

Denis

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

No branches or pull requests

2 participants