summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorAndriy Sokolovskiy <sokandpal@yandex.ru>2014-12-16 02:22:28 +0200
committerTim Graham <timograham@gmail.com>2014-12-16 10:48:49 -0500
commit3dbbb8a89ca4beaabd5359fe82e32ed633b15140 (patch)
tree5e2c2d0a89460fb9b28d3f830bbc2846e1af3e1a /django/db
parentca013e652f912e279c128d4d2631eaa3b02e4db7 (diff)
Fixed #23983 -- Fixed a crash in migrations when adding order_with_respect_to to non-empty table.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/migrations/operations/models.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index e92c3d6bd3..d6b6275da3 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -404,6 +404,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,