mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.7.x] Fixed #23983 -- Fixed a crash in migrations when adding order_with_respect_to to non-empty table.
Backport of 3dbbb8a89c from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							66c0529b3e
						
					
				
				
					commit
					10482faf19
				
			| @@ -329,6 +329,8 @@ class AlterOrderWithRespectTo(Operation): | ||||
|             # it's likely a rename) | ||||
|             elif to_model._meta.order_with_respect_to and not from_model._meta.order_with_respect_to: | ||||
|                 field = to_model._meta.get_field_by_name("_order")[0] | ||||
|                 if not field.has_default(): | ||||
|                     field.default = 0 | ||||
|                 schema_editor.add_field( | ||||
|                     from_model, | ||||
|                     field, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user