Skip to content

Commit d708298

Browse files
committed
Fixed django#18420 -- Prevented the admin JS from crashing when the main form contains no field. Thanks to maciej.maciaszek for the report and patch.
1 parent fadcc6d commit d708298

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

django/contrib/admin/templates/admin/change_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
{% block submit_buttons_bottom %}{% submit_row %}{% endblock %}
6767

68-
{% if adminform and add %}
68+
{% if adminform.first_field and add %}
6969
<script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
7070
{% endif %}
7171

0 commit comments

Comments
 (0)