File tree Expand file tree Collapse file tree 11 files changed +31
-33
lines changed
rest_framework/templates/rest_framework/inline Expand file tree Collapse file tree 11 files changed +31
-33
lines changed Original file line number Diff line number Diff line change 1
- < div class ="mb-3 {% if field.errors %}has-error{% endif %} ">
2
- < div class ="checkbox ">
1
+ < div class ="col-12 ">
2
+ < div class ="form-check ">
3
3
< label >
4
- < input type ="checkbox " name ="{{ field.name }} " value ="true " {% if field.value %}checked{% endif %} >
4
+ < input class =" form-check-input{% if field.errors %} is-invalid{% endif %} " type ="checkbox " name ="{{ field.name }} " value ="true " {% if field.value %}checked{% endif %} >
5
5
{% if field.label %}{{ field.label }}{% endif %}
6
6
</ label >
7
7
</ div >
Original file line number Diff line number Diff line change 1
1
{% load rest_framework %}
2
2
3
- < div class ="mb-3 {% if field.errors %}has-error{% endif %} ">
3
+ < div class ="col-12 ">
4
4
{% if field.label %}
5
5
< label class ="sr-only "> {{ field.label }}</ label >
6
6
{% endif %}
7
7
8
8
{% for key, text in field.choices|items %}
9
- < div class ="checkbox ">
10
- < label >
11
- < input type ="checkbox " name ="{{ field.name }} " value ="{{ key }} " {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %} >
12
- {{ text }}
13
- </ label >
9
+ < div class ="form-check {% if style.inline %}form-check-inline {% endif %} ">
10
+ < input class ="form-check-input{% if field.errors %} is-invalid{% endif %} " type ="checkbox " name ="{{ field.name }} " value ="{{ key }} " {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %} >
11
+ < label > {{ text }}</ label >
14
12
</ div >
15
13
{% endfor %}
16
14
</ div >
Original file line number Diff line number Diff line change 1
- < div class ="mb-3 ">
1
+ < div class ="col-12 ">
2
2
{% if field.label %}
3
3
< label class ="sr-only ">
4
4
{{ field.label }}
5
5
</ label >
6
6
{% endif %}
7
7
8
- < p class ="form-control-static "> Dictionaries are not currently supported in HTML input.</ p >
8
+ < p class ="form-text "> Dictionaries are not currently supported in HTML input.</ p >
9
9
</ div >
Original file line number Diff line number Diff line change 1
1
{% load rest_framework %}
2
+ < div class ="row row-cols-md-auto g-3 align-items-center ">
2
3
{% for field in form %}
3
4
{% if not field.read_only %}
4
5
{% render_field field style=style %}
5
6
{% endif %}
6
7
{% endfor %}
8
+ </ div >
Original file line number Diff line number Diff line change 1
- < div class ="mb-3 {% if field.errors %}has-error{% endif %} ">
1
+ < div class ="col-12 ">
2
2
{% if field.label %}
3
3
< label class ="sr-only ">
4
4
{{ field.label }}
5
5
</ label >
6
6
{% endif %}
7
7
8
- < input name ="{{ field.name }} " {% if style.input_type ! = "file " %}class ="form-control "{% endif %} type ="{{ style.input_type }} " {% if style.placeholder %}placeholder ="{{ style.placeholder }} "{% endif %} {% if field.value is not None %}value ="{{ field.value }} "{% endif %} {% if style.autofocus and style.input_type ! = "hidden " %}autofocus{% endif %} >
8
+ < input name ="{{ field.name }} " {% if style.input_type ! = "file " %}class ="form-control{% if field.errors %} is-invalid{% endif %} "{% endif %} type ="{{ style.input_type }} " {% if style.placeholder %}placeholder ="{{ style.placeholder }} "{% endif %} {% if field.value is not None %}value ="{{ field.value }} "{% endif %} {% if style.autofocus and style.input_type ! = "hidden " %}autofocus{% endif %} >
9
9
</ div >
Original file line number Diff line number Diff line change 1
- < div class ="mb-3 ">
1
+ < div class ="col-12 ">
2
2
{% if field.label %}
3
3
< label class ="sr-only ">
4
4
{{ field.label }}
5
5
</ label >
6
6
{% endif %}
7
7
8
- < p class ="form-control-static "> Lists are not currently supported in HTML input.</ p >
8
+ < p class ="form-text "> Lists are not currently supported in HTML input.</ p >
9
9
</ div >
Original file line number Diff line number Diff line change 1
- < span > Lists are not currently supported in HTML input.</ span >
1
+ < div class ="col-12 ">
2
+ < span class ="form-text "> Lists are not currently supported in HTML input.</ span >
3
+ </ div >
Original file line number Diff line number Diff line change 2
2
{% load rest_framework %}
3
3
{% trans "None" as none_choice %}
4
4
5
- < div class ="mb-3 {% if field.errors %}has-error{% endif %} ">
5
+ < div class ="col-12 ">
6
6
{% if field.label %}
7
7
< label class ="sr-only ">
8
8
{{ field.label }}
9
9
</ label >
10
10
{% endif %}
11
11
12
12
{% if field.allow_null or field.allow_blank %}
13
- < div class ="radio ">
14
- < label >
15
- < input type ="radio " name ="{{ field.name }} " value ="" {% if not field.value %}checked{% endif %} >
16
- {{ none_choice }}
17
- </ label >
13
+ < div class ="form-check {% if style.inline %}form-check-inline {% endif %} ">
14
+ < input class ="form-check-input{% if field.errors %} is-invalid{% endif %} " type ="radio " name ="{{ field.name }} " value ="" {% if not field.value %}checked{% endif %} >
15
+ < label > {{ none_choice }}</ label >
18
16
</ div >
19
17
{% endif %}
20
18
21
19
{% for key, text in field.choices|items %}
22
- < div class ="radio ">
23
- < label >
24
- < input type ="radio " name ="{{ field.name }} " value ="{{ key }} " {% if key|as_string == field.value|as_string %}checked{% endif %} >
25
- {{ text }}
26
- </ label >
20
+ < div class ="form-check {% if style.inline %}form-check-inline {% endif %} ">
21
+ < input class ="form-check-input{% if field.errors %} is-invalid{% endif %} " type ="radio " name ="{{ field.name }} " value ="{{ key }} " {% if key|as_string == field.value|as_string %}checked{% endif %} >
22
+ < label > {{ text }}</ label >
27
23
</ div >
28
24
{% endfor %}
29
25
</ div >
Original file line number Diff line number Diff line change 1
1
{% load rest_framework %}
2
2
3
- < div class ="mb-3 {% if field.errors %}has-error{% endif %} ">
3
+ < div class ="col-12 ">
4
4
{% if field.label %}
5
5
< label class ="sr-only ">
6
6
{{ field.label }}
7
7
</ label >
8
8
{% endif %}
9
9
10
- < select class ="form-control " name ="{{ field.name }} ">
10
+ < select class ="form-select{% if field.errors %} is-invalid{% endif %} " name ="{{ field.name }} ">
11
11
{% if field.allow_null or field.allow_blank %}
12
12
< option value ="" {% if not field.value %}selected{% endif %} > --------</ option >
13
13
{% endif %}
Original file line number Diff line number Diff line change 2
2
{% load rest_framework %}
3
3
{% trans "No items to select." as no_items %}
4
4
5
- < div class ="mb-3 {% if field.errors %}has-error{% endif %} ">
5
+ < div class ="col-12 ">
6
6
{% if field.label %}
7
7
< label class ="sr-only ">
8
8
{{ field.label }}
9
9
</ label >
10
10
{% endif %}
11
11
12
- < select multiple {{ field.choices|yesno: ",disabled" }} class="form-control " name ="{{ field.name }} ">
12
+ < select multiple {{ field.choices|yesno: ",disabled" }} class="form-select{% if field.errors %} is-invalid{% endif %} " name ="{{ field.name }} ">
13
13
{% for select in field.iter_options %}
14
14
{% if select.start_option_group %}
15
15
< optgroup label ="{{ select.label }} ">
Original file line number Diff line number Diff line change 1
- < div class ="mb-3 {% if field.errors %}has-error{% endif %} ">
1
+ < div class ="col-12 ">
2
2
{% if field.label %}
3
3
< label class ="sr-only ">
4
4
{{ field.label }}
5
5
</ label >
6
6
{% endif %}
7
7
8
- < input name ="{{ field.name }} " type ="text " class ="form-control " {% if style.placeholder %}placeholder ="{{ style.placeholder }} "{% endif %} {% if field.value %}value ="{{ field.value }} "{% endif %} >
8
+ < input name ="{{ field.name }} " type ="text " class ="form-control{% if field.errors %} is-invalid{% endif %} " {% if style.placeholder %}placeholder ="{{ style.placeholder }} "{% endif %} {% if field.value %}value ="{{ field.value }} "{% endif %} >
9
9
</ div >
You can’t perform that action at this time.
0 commit comments