Ticket #18420: django_admin_first_field_focus.2.diff

File django_admin_first_field_focus.2.diff, 747 bytes (added by maciej.maciaszek@…, 7 years ago)

fixed diff

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

     
    6566
    6667{% block submit_buttons_bottom %}{% submit_row %}{% endblock %}
    6768
    68 {% if adminform and add %}
    69    <script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
     69{% if adminform.first_field and add %}               
     70    <script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
    7071{% endif %}
    7172
    7273{# JavaScript for prepopulated fields #}
Back to Top