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

Provide additional direction on resolving N+1 issues for ModelAdmin classes #1684

Open
tim-schilling opened this issue Oct 20, 2022 · 0 comments

Comments

@tim-schilling
Copy link
Contributor

@charettes raised a great idea where the toolbar could highlight where and how a developer could resolve an N+1 error.

For example, if the admin is setup to generate an N+1 error, we would direct them to either add the relationship(s) to list_select_related or to override get_queryset() to add a call to prefetch_related.

There may be a way to also provide this for the generic class based views as well (ListModelMixin), etc. It'd be neat to do this for DRF ViewSets/Views.

This could be difficult when the view has overriden get_queryset a few times and knowing which one should be modified. Though perhaps we start with the last defined method and point the user to that.

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

1 participant