mirror of
				https://github.com/django/django.git
				synced 2025-10-30 00:56:09 +00:00 
			
		
		
		
	Fixed #22023 -- Raised an error for values() followed by defer() or only().
Previously, doing so resulted in invalid data or crash. Thanks jtiai for the report and Karol Jochelson, Jakub Nowak, Loic Bistuer, and Baptiste Mispelon for reviews.
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							a7639722f5
						
					
				
				
					commit
					faf6a911ad
				
			| @@ -1060,6 +1060,12 @@ class ValuesQuerySet(QuerySet): | ||||
|         # QuerySet.clone() will also set up the _fields attribute with the | ||||
|         # names of the model fields to select. | ||||
|  | ||||
|     def only(self, *fields): | ||||
|         raise NotImplementedError("ValuesQuerySet does not implement only()") | ||||
|  | ||||
|     def defer(self, *fields): | ||||
|         raise NotImplementedError("ValuesQuerySet does not implement defer()") | ||||
|  | ||||
|     def iterator(self): | ||||
|         # Purge any extra columns that haven't been explicitly asked for | ||||
|         extra_names = list(self.query.extra_select) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user