mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-11-04 18:08:01 +03:00 
			
		
		
		
	Add support for MultipleChoiceField
This commit is contained in:
		
							parent
							
								
									510ee9383e
								
							
						
					
					
						commit
						1a04d608ed
					
				| 
						 | 
					@ -91,3 +91,8 @@ def convert_serializer_field_to_dict(field):
 | 
				
			||||||
@get_graphene_type_from_serializer_field.register(serializers.JSONField)
 | 
					@get_graphene_type_from_serializer_field.register(serializers.JSONField)
 | 
				
			||||||
def convert_serializer_field_to_jsonstring(field):
 | 
					def convert_serializer_field_to_jsonstring(field):
 | 
				
			||||||
    return graphene.types.json.JSONString
 | 
					    return graphene.types.json.JSONString
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@get_graphene_type_from_serializer_field.register(serializers.MultipleChoiceField)
 | 
				
			||||||
 | 
					def convert_serializer_field_to_list_of_string(field):
 | 
				
			||||||
 | 
					    return (graphene.List, graphene.String)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,3 +144,9 @@ def test_should_image_convert_string():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_should_json_convert_jsonstring():
 | 
					def test_should_json_convert_jsonstring():
 | 
				
			||||||
    assert_conversion(serializers.JSONField, graphene.types.json.JSONString)
 | 
					    assert_conversion(serializers.JSONField, graphene.types.json.JSONString)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_should_multiplechoicefield_convert_to_list_of_string():
 | 
				
			||||||
 | 
					    field = assert_conversion(serializers.MultipleChoiceField, graphene.List, choices=[1,2,3])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert field.of_type == graphene.String
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user