diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index af1df5e6680..a91988bc475 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -46,20 +46,6 @@ class AdminForm(object): **options ) - def first_field(self): - try: - fieldset_name, fieldset_options = self.fieldsets[0] - field_name = fieldset_options['fields'][0] - if not isinstance(field_name, six.string_types): - field_name = field_name[0] - return self.form[field_name] - except (KeyError, IndexError): - pass - try: - return next(iter(self.form)) - except StopIteration: - return None - def _media(self): media = self.form.media for fs in self: diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index e35c7328f48..b2df1dcd3da 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -66,8 +66,14 @@ {% block submit_buttons_bottom %}{% submit_row %}{% endblock %} -{% if adminform.first_field and add %} - +{% if adminform and add %} + {% endif %} {# JavaScript for prepopulated fields #}