summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2012-06-16 17:18:23 -0700
committerJulien Phalip <jphalip@gmail.com>2012-06-16 17:18:23 -0700
commitd708298184f8e19f250d2cee5bb900e496ed1175 (patch)
treec55c3bc5c687f7fd820abfecbc477893048bf0e2
parentfadcc6ddb7f5dfde14fd80497b21076cadae927f (diff)
Fixed #18420 -- Prevented the admin JS from crashing when the main form contains no field. Thanks to maciej.maciaszek for the report and patch.
-rw-r--r--django/contrib/admin/templates/admin/change_form.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html
index ead37b187f..e455793f68 100644
--- a/django/contrib/admin/templates/admin/change_form.html
+++ b/django/contrib/admin/templates/admin/change_form.html
@@ -65,7 +65,7 @@
{% block submit_buttons_bottom %}{% submit_row %}{% endblock %}
-{% if adminform and add %}
+{% if adminform.first_field and add %}
<script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
{% endif %}