mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	Add missing commas in Prefetch docs
This commit is contained in:
		
							parent
							
								
									a739573e17
								
							
						
					
					
						commit
						957d22b850
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -956,14 +956,14 @@ This allows prefetching the same relation multiple times with a different
 | 
			
		|||
    >>> vegetarian_pizzas = Pizza.objects.filter(vegetarian=True)
 | 
			
		||||
    >>> Restaurant.objects.prefetch_related(
 | 
			
		||||
    ...     Prefetch('pizzas', to_attr('menu')),
 | 
			
		||||
    ...     Prefetch('pizzas', queryset=vegetarian_pizzas to_attr='vegetarian_menu'))
 | 
			
		||||
    ...     Prefetch('pizzas', queryset=vegetarian_pizzas, to_attr='vegetarian_menu'))
 | 
			
		||||
 | 
			
		||||
Lookups created with custom ``to_attr`` can still be traversed as usual by other
 | 
			
		||||
lookups:
 | 
			
		||||
 | 
			
		||||
    >>> vegetarian_pizzas = Pizza.objects.filter(vegetarian=True)
 | 
			
		||||
    >>> Restaurant.objects.prefetch_related(
 | 
			
		||||
    ...     Prefetch('pizzas', queryset=vegetarian_pizzas to_attr='vegetarian_menu'),
 | 
			
		||||
    ...     Prefetch('pizzas', queryset=vegetarian_pizzas, to_attr='vegetarian_menu'),
 | 
			
		||||
    ...     'vegetarian_menu__toppings')
 | 
			
		||||
 | 
			
		||||
Using ``to_attr`` is recommended when filtering down the prefetch result as it is
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue