mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-11-04 09:57:53 +03:00 
			
		
		
		
	Set converted Django connections to required (#610)
This commit is contained in:
		
							parent
							
								
									b1a9293016
								
							
						
					
					
						commit
						59f4f134b5
					
				| 
						 | 
					@ -195,9 +195,11 @@ def convert_field_to_list_or_connection(field, registry=None):
 | 
				
			||||||
            if _type._meta.filter_fields or _type._meta.filterset_class:
 | 
					            if _type._meta.filter_fields or _type._meta.filterset_class:
 | 
				
			||||||
                from .filter.fields import DjangoFilterConnectionField
 | 
					                from .filter.fields import DjangoFilterConnectionField
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return DjangoFilterConnectionField(_type, description=description)
 | 
					                return DjangoFilterConnectionField(
 | 
				
			||||||
 | 
					                    _type, required=True, description=description
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return DjangoConnectionField(_type, description=description)
 | 
					            return DjangoConnectionField(_type, required=True, description=description)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return DjangoListField(
 | 
					        return DjangoListField(
 | 
				
			||||||
            _type,
 | 
					            _type,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
 | 
				
			||||||
        return partial(
 | 
					        return partial(
 | 
				
			||||||
            self.connection_resolver,
 | 
					            self.connection_resolver,
 | 
				
			||||||
            parent_resolver,
 | 
					            parent_resolver,
 | 
				
			||||||
            self.type,
 | 
					            self.connection_type,
 | 
				
			||||||
            self.get_manager(),
 | 
					            self.get_manager(),
 | 
				
			||||||
            self.max_limit,
 | 
					            self.max_limit,
 | 
				
			||||||
            self.enforce_first_or_last,
 | 
					            self.enforce_first_or_last,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -255,7 +255,7 @@ def test_should_manytomany_convert_connectionorlist_connection():
 | 
				
			||||||
    assert isinstance(graphene_field, graphene.Dynamic)
 | 
					    assert isinstance(graphene_field, graphene.Dynamic)
 | 
				
			||||||
    dynamic_field = graphene_field.get_type()
 | 
					    dynamic_field = graphene_field.get_type()
 | 
				
			||||||
    assert isinstance(dynamic_field, ConnectionField)
 | 
					    assert isinstance(dynamic_field, ConnectionField)
 | 
				
			||||||
    assert dynamic_field.type == A._meta.connection
 | 
					    assert dynamic_field.type.of_type == A._meta.connection
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_should_manytoone_convert_connectionorlist():
 | 
					def test_should_manytoone_convert_connectionorlist():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,7 +173,7 @@ type Reporter {
 | 
				
			||||||
  pets: [Reporter!]!
 | 
					  pets: [Reporter!]!
 | 
				
			||||||
  aChoice: ReporterAChoice
 | 
					  aChoice: ReporterAChoice
 | 
				
			||||||
  reporterType: ReporterReporterType
 | 
					  reporterType: ReporterReporterType
 | 
				
			||||||
  articles(before: String, after: String, first: Int, last: Int): ArticleConnection
 | 
					  articles(before: String, after: String, first: Int, last: Int): ArticleConnection!
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum ReporterAChoice {
 | 
					enum ReporterAChoice {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user