mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-11-04 09:57:53 +03:00 
			
		
		
		
	Fix failing unit test by handling cases where a connection is resolved involving a query with inner join and distinct that is then filtered and would be combined with a filtered queryset that is not distinct.
This commit is contained in:
		
							parent
							
								
									23eb8eea80
								
							
						
					
					
						commit
						e05fbcc1b3
					
				| 
						 | 
					@ -77,6 +77,10 @@ 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:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -478,7 +478,7 @@ def test_should_query_node_filtering_with_distinct_queryset():
 | 
				
			||||||
        'films': {
 | 
					        'films': {
 | 
				
			||||||
            'edges': [{
 | 
					            'edges': [{
 | 
				
			||||||
                'node': {
 | 
					                'node': {
 | 
				
			||||||
                    'genre': 'ot'
 | 
					                    'genre': 'OT'
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }]
 | 
					            }]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user