From 1d4c52c8bf62cc912e5099e86ff229b69ce9d227 Mon Sep 17 00:00:00 2001 From: SnippyCodes Date: Sat, 31 Jan 2026 13:43:17 +0530 Subject: [PATCH 1/2] Fixed #36893 -- Serialized elidable kwarg for RunSQL and RunPython operations. --- django/db/migrations/operations/special.py | 4 ++++ tests/migrations/test_operations.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/django/db/migrations/operations/special.py b/django/db/migrations/operations/special.py index 07000233253c..311271483ea9 100644 --- a/django/db/migrations/operations/special.py +++ b/django/db/migrations/operations/special.py @@ -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 @@ -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 diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index e859b62a101b..90c22bc73bc7 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -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. @@ -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): From 24a14860ced5c456522d69c16afd2c631cc0456f Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Mon, 2 Feb 2026 21:09:54 -0500 Subject: [PATCH 2/2] Fixed line length in admin_views test_prepopulated_fields(). --- tests/admin_views/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 95be0ed89d7b..7949622f0ea9 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -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(