Created
November 29, 2017 18:42
-
-
Save vkosh/37ef967340c11981f22ba7ede90c8adf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from queryset_sequence import QuerySetSequence | |
class MyQuerySetSequence(QuerySetSequence): | |
INHERITED_ATTRS = [ | |
'_cloning', | |
# Public methods that return QuerySets. | |
'filter', | |
'exclude', | |
'order_by', | |
'reverse', | |
'none', | |
'all', | |
'select_related', | |
# Public methods that don't return QuerySets. | |
'get', | |
'count', | |
'as_manager', | |
'exists', | |
# Public introspection attributes. | |
'ordered', | |
'db', | |
# Private methods. | |
'_chain', | |
'_clone', | |
'_fetch_all', | |
'_merge_sanity_check', | |
'_prepare', | |
] | |
NOT_IMPLEMENTED_ATTRS = [ | |
# Public methods that return QuerySets. | |
'annotate', | |
'distinct', | |
'values', | |
'values_list', | |
'dates', | |
'datetimes', | |
'extra', | |
'defer', | |
'only', | |
'using', | |
'select_for_update', | |
'raw', | |
# Public methods that don't return QuerySets. | |
'latest', | |
'earliest', | |
'first', | |
'last', | |
'aggregate', | |
# Public methods that don't return QuerySets. These don't make sense in | |
# the context of a QuerySetSequence. | |
'create', | |
'get_or_create', | |
'update_or_create', | |
'bulk_create', | |
'in_bulk', | |
'update', | |
] | |
q = MyQuerySetSequence(Model1.objects.all(), Model2.objects.all()) | |
print(q.all()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment