Skip to content

Commit 123fa3a

Browse files
timgrahamjacobtylerwalls
authored andcommitted
Refs #36949 -- Removed hardcoded pks in modeladmin tests.
1 parent fcf9168 commit 123fa3a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/modeladmin/tests.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,8 @@ class ConcertAdmin(ModelAdmin):
849849
'class="related-widget-wrapper" data-model-ref="band"><select '
850850
'name="main_band" data-context="available-source" required '
851851
'id="id_main_band" data-custom-widget="true" multiple>'
852-
'<option value="">---------</option><option value="1">The Doors</option>'
852+
'<option value="">---------</option>'
853+
f'<option value="{self.band.pk}">The Doors</option>'
853854
"</select></div></div>"
854855
)
855856
self.assertInHTML(expected, cmafa().render())
@@ -873,9 +874,10 @@ class ConcertAdmin(ModelAdmin):
873874
expected = (
874875
'<fieldset><legend>Main band:</legend><div class="related-widget-wrapper" '
875876
'data-model-ref="band"><div id="id_main_band"><div><label '
876-
'for="id_main_band_0"><input type="radio" name="main_band" value="1" '
877-
'data-context="available-source" required id="id_main_band_0" '
878-
'use_fieldset="true">The Doors</label></div></div></div></fieldset>'
877+
'for="id_main_band_0"><input type="radio" name="main_band" '
878+
f'value="{self.band.pk}" data-context="available-source" '
879+
'required id="id_main_band_0" use_fieldset="true">The Doors</label>'
880+
"</div></div></div></fieldset>"
879881
)
880882
self.assertInHTML(expected, cmafa().render())
881883

0 commit comments

Comments
 (0)