diff options
| author | Tim Graham <timograham@gmail.com> | 2026-04-03 09:13:11 -0400 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-04-03 15:29:55 -0400 |
| commit | ffc83c554a7bc99e138445fa2c4beaf0ca17c71c (patch) | |
| tree | 7f5fc8daec678bd5ecf1afef2de6ee3ceb94b46b | |
| parent | 4eb38f6994f233feeac5852cbee2ae6663a9b1ef (diff) | |
[6.0.x] Refs #36949 -- Removed hardcoded pks in modeladmin tests.
Backport of 123fa3a3f38abdb73055acc9a2cbbe3537f9323a from main.
| -rw-r--r-- | tests/modeladmin/tests.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index c1c8b52346..db3a841a6b 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -849,7 +849,8 @@ class ModelAdminTests(TestCase): 'class="related-widget-wrapper" data-model-ref="band"><select ' 'name="main_band" data-context="available-source" required ' 'id="id_main_band" data-custom-widget="true" multiple>' - '<option value="">---------</option><option value="1">The Doors</option>' + '<option value="">---------</option>' + f'<option value="{self.band.pk}">The Doors</option>' "</select></div></div>" ) self.assertInHTML(expected, cmafa().render()) @@ -873,9 +874,10 @@ class ModelAdminTests(TestCase): expected = ( '<fieldset><legend>Main band:</legend><div class="related-widget-wrapper" ' 'data-model-ref="band"><div id="id_main_band"><div><label ' - 'for="id_main_band_0"><input type="radio" name="main_band" value="1" ' - 'data-context="available-source" required id="id_main_band_0" ' - 'use_fieldset="true">The Doors</label></div></div></div></fieldset>' + 'for="id_main_band_0"><input type="radio" name="main_band" ' + f'value="{self.band.pk}" data-context="available-source" ' + 'required id="id_main_band_0" use_fieldset="true">The Doors</label>' + "</div></div></div></fieldset>" ) self.assertInHTML(expected, cmafa().render()) |
