mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-01-31 11:48:38 +03:00
Move distinct check code to merge_querysets again
This commit is contained in:
parent
4d41160379
commit
34f5978446
|
@ -67,6 +67,10 @@ class DjangoConnectionField(ConnectionField):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def merge_querysets(cls, default_queryset, queryset):
|
def merge_querysets(cls, default_queryset, queryset):
|
||||||
|
if default_queryset.query.distinct and not queryset.query.distinct:
|
||||||
|
queryset = queryset.distinct()
|
||||||
|
elif queryset.query.distinct and not default_queryset.query.distinct:
|
||||||
|
default_queryset = default_queryset.distinct()
|
||||||
return queryset & default_queryset
|
return queryset & default_queryset
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -77,10 +81,6 @@ class DjangoConnectionField(ConnectionField):
|
||||||
if isinstance(iterable, QuerySet):
|
if isinstance(iterable, QuerySet):
|
||||||
if iterable is not default_manager:
|
if iterable is not default_manager:
|
||||||
default_queryset = maybe_queryset(default_manager)
|
default_queryset = maybe_queryset(default_manager)
|
||||||
if default_queryset.query.distinct and not iterable.query.distinct:
|
|
||||||
iterable = iterable.distinct()
|
|
||||||
elif iterable.query.distinct and not default_queryset.query.distinct:
|
|
||||||
default_queryset = default_queryset.distinct()
|
|
||||||
iterable = cls.merge_querysets(default_queryset, iterable)
|
iterable = cls.merge_querysets(default_queryset, iterable)
|
||||||
_len = iterable.count()
|
_len = iterable.count()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user