File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ class DisabledSelectTestForm(forms.Form):
22
22
widget = forms .RadioSelect ,
23
23
disabled = True ,
24
24
)
25
+
26
+
27
+ class SelectOtherTestForm (forms .Form ):
28
+ test = forms .ChoiceField (
29
+ choices = (
30
+ (1 , "one" ),
31
+ (2 , "two" ),
32
+ ),
33
+ widget = forms .RadioSelect (attrs = {"form" : "another-form" })
25
34
26
35
27
36
class BootstrapFieldSelectTestCase (BootstrapTestCase ):
@@ -111,3 +120,25 @@ def test_disabled_select(self):
111
120
"</div>"
112
121
),
113
122
)
123
+
124
+ def test_other_form_select (self ):
125
+ """Test field with select that belongs to another form widget."""
126
+ self .maxDiff = None
127
+ self .assertHTMLEqual (
128
+ self .render ("{% bootstrap_field form.test %}" , context = {"form" : DisabledSelectTestForm ()}),
129
+ (
130
+ '<div class="django_bootstrap5-req mb-3">'
131
+ '<label class="form-label">Test</label>'
132
+ '<div class="" disabled required id="id_test">'
133
+ '<div class="form-check">'
134
+ '<input class="form-check-input" form="another-form" type="radio" name="test" id="id_test_0" value="1">'
135
+ '<label class="form-check-label" for="id_test_0">one</label>'
136
+ "</div>"
137
+ '<div class="form-check">'
138
+ '<input class="form-check-input" form="another-form" type="radio" name="test" id="id_test_1" value="2">'
139
+ '<label class="form-check-label" for="id_test_1">two</label>'
140
+ "</div>"
141
+ "</div>"
142
+ "</div>"
143
+ ),
144
+ )
You can’t perform that action at this time.
0 commit comments