mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-01-31 03:34:13 +03:00
Merge pull request #224 from camd/fix-select-related
Fix select_related with filtering
This commit is contained in:
commit
9e26aaf6ad
|
@ -43,8 +43,8 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
||||||
def filtering_args(self):
|
def filtering_args(self):
|
||||||
return get_filtering_args_from_filterset(self.filterset_class, self.node_type)
|
return get_filtering_args_from_filterset(self.filterset_class, self.node_type)
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def merge_querysets(default_queryset, queryset):
|
def merge_querysets(cls, default_queryset, queryset):
|
||||||
# There could be the case where the default queryset (returned from the filterclass)
|
# There could be the case where the default queryset (returned from the filterclass)
|
||||||
# and the resolver queryset have some limits on it.
|
# and the resolver queryset have some limits on it.
|
||||||
# We only would be able to apply one of those, but not both
|
# We only would be able to apply one of those, but not both
|
||||||
|
@ -61,7 +61,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
||||||
low = default_queryset.query.low_mark or queryset.query.low_mark
|
low = default_queryset.query.low_mark or queryset.query.low_mark
|
||||||
high = default_queryset.query.high_mark or queryset.query.high_mark
|
high = default_queryset.query.high_mark or queryset.query.high_mark
|
||||||
default_queryset.query.clear_limits()
|
default_queryset.query.clear_limits()
|
||||||
queryset = queryset & default_queryset
|
queryset = super(cls, cls).merge_querysets(default_queryset, queryset)
|
||||||
queryset.query.set_limits(low, high)
|
queryset.query.set_limits(low, high)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user