Skip to content

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.

3 participants