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

Support custom queryset on detail views #68

Merged
merged 1 commit into from
Nov 5, 2021

Conversation

stevelacey
Copy link
Contributor

@stevelacey stevelacey commented Nov 4, 2021

What's this PR do?

Adds support for supplying a custom queryset directly on a detail or via overriding the get_queryset method.

Also drops the internal usage of get_instance_or_http404 which I suspect doesn't add value anymore now that dispatch catches ObjectDoesNotExist... though I haven't made sure, but the tests would fail right. Right?

Why is this important, or what issue does this solve?

Sometimes model.objects.all() isn't enough, maybe you wanna apply some filters, or pull the queryset off of a request.user relation.

Also this is already supported on list views.

Where should the reviewer start?

Detail views.

What Worf gif best describes this PR or how it makes you feel?

worf_right

Tasks

  • This PR increases test coverage

@stevelacey stevelacey marked this pull request as draft November 4, 2021 12:27
@stevelacey stevelacey marked this pull request as ready for review November 4, 2021 12:31
@stevelacey stevelacey force-pushed the improvement/detail-queryset branch from 727e79d to ed421a2 Compare November 5, 2021 05:03
@stevelacey stevelacey merged commit bf1d45c into master Nov 5, 2021
@stevelacey stevelacey deleted the improvement/detail-queryset branch November 5, 2021 05:16
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

Successfully merging this pull request may close these issues.

1 participant