Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions django/db/migrations/operations/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def deconstruct(self):
kwargs["state_operations"] = self.state_operations
if self.hints:
kwargs["hints"] = self.hints
if self.elidable:
kwargs["elidable"] = self.elidable
return (self.__class__.__qualname__, [], kwargs)

@property
Expand Down Expand Up @@ -173,6 +175,8 @@ def deconstruct(self):
kwargs["atomic"] = self.atomic
if self.hints:
kwargs["hints"] = self.hints
if self.elidable:
kwargs["elidable"] = self.elidable
return (self.__class__.__qualname__, [], kwargs)

@property
Expand Down
4 changes: 2 additions & 2 deletions tests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6101,8 +6101,8 @@ def test_prepopulated_fields(self):
status = self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-2-0-status"
)
# Fix for Firefox which does not scroll to clicked elements automatically with
# the Options API
# Fix for Firefox which does not scroll to clicked elements
# automatically with the Options API
self.selenium.execute_script("arguments[0].scrollIntoView();", status)
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.selenium.find_element(
Expand Down
8 changes: 8 additions & 0 deletions tests/migrations/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5543,6 +5543,10 @@ def test_run_sql(self):
elidable_operation = migrations.RunSQL("SELECT 1 FROM void;", elidable=True)
self.assertEqual(elidable_operation.reduce(operation, []), [operation])

# Test elidable deconstruction
definition = elidable_operation.deconstruct()
self.assertIs(definition[2]["elidable"], True)

def test_run_sql_params(self):
"""
#23426 - RunSQL should accept parameters.
Expand Down Expand Up @@ -5796,6 +5800,10 @@ def create_shetlandponies(models, schema_editor):
elidable_operation = migrations.RunPython(inner_method, elidable=True)
self.assertEqual(elidable_operation.reduce(operation, []), [operation])

# Test elidable deconstruction
definition = elidable_operation.deconstruct()
self.assertIs(definition[2]["elidable"], True)

def test_run_python_invalid_reverse_code(self):
msg = "RunPython must be supplied with callable arguments"
with self.assertRaisesMessage(ValueError, msg):
Expand Down