mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.10.x] Fixed #26987 -- Documented using QuerySet.get() without arguments.
Backport of f3b601f11a from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							33783a9e06
						
					
				
				
					commit
					a77d979cbd
				
			| @@ -1624,6 +1624,11 @@ The :exc:`~django.db.models.Model.DoesNotExist` exception inherits from | ||||
|     except ObjectDoesNotExist: | ||||
|         print("Either the entry or blog doesn't exist.") | ||||
|  | ||||
| If you expect a queryset to return one row, you can use ``get()`` without any | ||||
| arguments to return the object for that row:: | ||||
|  | ||||
|     entry = Entry.objects.filter(...).exclude(...).get() | ||||
|  | ||||
| ``create()`` | ||||
| ~~~~~~~~~~~~ | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user