mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	Fixed #7284 -- Provided an example for the use of the search_fields clause on ModelAdmin. Thanks to rbell01824@earthlink.net for the suggestion, and Simon Meers for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		
							parent
							
								
									244e7b9334
								
							
						
					
					
						commit
						bafe9fdef2
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -600,6 +600,11 @@ the lookup API "follow" notation::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    search_fields = ['foreign_key__related_fieldname']
 | 
					    search_fields = ['foreign_key__related_fieldname']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For example, if you have a blog entry with an author, the following definition
 | 
				
			||||||
 | 
					would enable search blog entries by the email address of the author::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    search_fields = ['user__email']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When somebody does a search in the admin search box, Django splits the search
 | 
					When somebody does a search in the admin search box, Django splits the search
 | 
				
			||||||
query into words and returns all objects that contain each of the words, case
 | 
					query into words and returns all objects that contain each of the words, case
 | 
				
			||||||
insensitive, where each word must be in at least one of ``search_fields``. For
 | 
					insensitive, where each word must be in at least one of ``search_fields``. For
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue