mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 07:57:26 +03:00 
			
		
		
		
	Adding comments to filter_for_reverse_field()
This commit is contained in:
		
							parent
							
								
									64ec0ca94f
								
							
						
					
					
						commit
						be6b2bf290
					
				|  | @ -58,14 +58,22 @@ class GrapheneFilterSetMixin(object): | |||
| 
 | ||||
|     @classmethod | ||||
|     def filter_for_reverse_field(cls, f, name): | ||||
|         """Handles retrieving filters for reverse relationships | ||||
| 
 | ||||
|         We override the default implementation so that we can handle | ||||
|         Global IDs (the default implementation expects database | ||||
|         primary keys) | ||||
|         """ | ||||
|         rel = f.field.rel | ||||
|         default = { | ||||
|             'name': name, | ||||
|             'label': capfirst(rel.related_name) | ||||
|         } | ||||
|         if rel.multiple: | ||||
|             # For to-many relationships | ||||
|             return GlobalIDMultipleChoiceFilter(**default) | ||||
|         else: | ||||
|             # For to-one relationships | ||||
|             return GlobalIDFilter(**default) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user