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

new retrieve permissions working on "site" custom tag of events #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

megies
Copy link
Collaborator

@megies megies commented May 3, 2016

..in order to filter out small events at certain sites. Based on #21. No need to merge in a hurry, pushing this mostly for visibility, as the motivating use case for #21.

negate = True
queryset = queryset.model.objects.get_filtered_queryset(
document_type="quakeml", queryset=queryset, negate=negate,
**kwargs)
Copy link
Collaborator

@barsch barsch May 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can filter also right here by appending your filter after get_filtered_queryset(), as this should return a QuerySet object itself - as long the queryset is not evaluated by looping over it you can continue to modify it like filtering, ordering etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw that, but I couldn't figure out how to invert the queryset at the end, so the only way I saw was to combine all these queries and invert them inside the SQL extra(where=..) query.

megies added 2 commits May 9, 2016 16:34
i.e. make the filter not return events that match all given criteria,
but rather return events, that do not match the combination of given
criteria.

otherwise it is impossible to define a retrieve permission for a
combination of two criteria (i.e. when user "does not have permission"
to exclude events that match the given combination of criteria, e.g.
exclude events at site X and below magnitude Y)
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