mirror of https://github.com/django/django.git
Removed the bulk of the sanity checking when merging QuerySets.
It was causing too many inconvenient and unintended problems when merging legitimate subclasses (e.g. with geo-django classes). There's still a hook there that we use when merging ValueQuerySets, but if you try to merge two disparate QuerySets and it breaks all that happens is you get to keep both pieces. We're no longer penalising the useful usages just for the people who aren't concentrating. Fixed #7113. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
588eeb356c
commit
002dbd16b4
|
@ -583,11 +583,11 @@ class QuerySet(object):
|
||||||
|
|
||||||
def _merge_sanity_check(self, other):
|
def _merge_sanity_check(self, other):
|
||||||
"""
|
"""
|
||||||
Checks that we are merging two comparable queryset classes.
|
Checks that we are merging two comparable queryset classes. By default
|
||||||
|
this does nothing, but see the ValuesQuerySet for an example of where
|
||||||
|
it's useful.
|
||||||
"""
|
"""
|
||||||
if self.__class__ is not other.__class__:
|
pass
|
||||||
raise TypeError("Cannot merge querysets of different types ('%s' and '%s'."
|
|
||||||
% (self.__class__.__name__, other.__class__.__name__))
|
|
||||||
|
|
||||||
class ValuesQuerySet(QuerySet):
|
class ValuesQuerySet(QuerySet):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue