Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
9c6bead8
Commit
9c6bead8
authored
Nov 20, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --- null option for selects. Closes #2096.
parent
6794b338
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
rest_framework/templates/rest_framework/horizontal/select.html
+3
-0
rest_framework/templates/rest_framework/inline/select.html
+4
-1
rest_framework/templates/rest_framework/vertical/select.html
+4
-1
No files found.
rest_framework/templates/rest_framework/horizontal/select.html
View file @
9c6bead8
...
...
@@ -4,6 +4,9 @@
{% endif %}
<div
class=
"col-sm-10"
>
<select
class=
"form-control"
name=
"{{ field.name }}"
>
{% if field.allow_null %}
<option
value=
""
{%
if
not
field
.
value
%}
selected
{%
endif
%}
>
--------
</option>
{% endif %}
{% for key, text in field.choices.items %}
<option
value=
"{{ key }}"
{%
if
key =
=
field
.
value
%}
selected
{%
endif
%}
>
{{ text }}
</option>
{% endfor %}
...
...
rest_framework/templates/rest_framework/inline/select.html
View file @
9c6bead8
...
...
@@ -3,8 +3,11 @@
<label
class=
"sr-only"
>
{{ field.label }}
</label>
{% endif %}
<select
class=
"form-control"
name=
"{{ field.name }}"
>
{% if field.allow_null %}
<option
value=
""
{%
if
not
field
.
value
%}
selected
{%
endif
%}
>
--------
</option>
{% endif %}
{% for key, text in field.choices.items %}
<option
value=
"{{ key }}"
{%
if
key =
=
field
.
value
%}
selected
{%
endif
%}
>
{{ text }}
</option>
<option
value=
"{{ key }}"
{%
if
key =
=
field
.
value
%}
selected
{%
endif
%}
>
{{ text }}
</option>
{% endfor %}
</select>
</div>
rest_framework/templates/rest_framework/vertical/select.html
View file @
9c6bead8
...
...
@@ -3,8 +3,11 @@
<label
{%
if
style
.
hide_label
%}
class=
"sr-only"
{%
endif
%}
>
{{ field.label }}
</label>
{% endif %}
<select
class=
"form-control"
name=
"{{ field.name }}"
>
{% if field.allow_null %}
<option
value=
""
{%
if
not
field
.
value
%}
selected
{%
endif
%}
>
--------
</option>
{% endif %}
{% for key, text in field.choices.items %}
<option
value=
"{{ key }}"
{%
if
key =
=
field
.
value
%}
selected
{%
endif
%}
>
{{ text }}
</option>
<option
value=
"{{ key }}"
{%
if
key =
=
field
.
value
%}
selected
{%
endif
%}
>
{{ text }}
</option>
{% endfor %}
</select>
{% if field.errors %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment