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

Annotation filters #70

Merged
merged 2 commits into from
Nov 8, 2021
Merged

Annotation filters #70

merged 2 commits into from
Nov 8, 2021

Conversation

stevelacey
Copy link
Contributor

@stevelacey stevelacey commented Nov 8, 2021

What's this PR do?

Adds support for generating filters automatically out of annotations applied to view querysets.

This saves client's from repeating the filter_fields within a custom filterset when they want to support filtering based on an annotation.

This makes it easier to disconnect the db structure from query param filters supported by a view.

Where should the reviewer start?

Annotate some fields on a queryset then add the annotation into filter_fields.

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

Annotations are applied on the queryset not the model, so url_filter's ModelFilterSet doesn't introspect them by default.

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

Tasks

  • This PR increases test coverage
  • This PR includes README updates reflecting any new features/improvements to the framework

@stevelacey stevelacey force-pushed the improvement/annotation-filters branch from fd20417 to cf01378 Compare November 8, 2021 16:31
@stevelacey stevelacey merged commit a8fb9e9 into master Nov 8, 2021
@stevelacey stevelacey deleted the improvement/annotation-filters branch November 8, 2021 16:41
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.

2 participants