mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-08 06:14:47 +03:00
Update select.html
In relations.py: relations.py:PrimaryKeyRelatedField.to_representation mostly (by default) returns an integer, but RelatedField.choices converts all to the string. That is why "select" field on "update" action, usually does not work correctly.
This commit is contained in:
parent
aa3f844b3d
commit
14532757f6
|
@ -11,7 +11,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for key, text in field.choices.items %}
|
{% 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|slugify %}selected{% endif %}>{{ text }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user