Fixed #8194: `AdminForm.first_field` now correctly returns the first field when using custom field orders.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-08-28 20:48:59 +00:00
parent 503fda43fa
commit fe8e00ae06
1 changed files with 4 additions and 2 deletions

View File

@ -20,8 +20,10 @@ class AdminForm(object):
yield Fieldset(self.form, name, **options) yield Fieldset(self.form, name, **options)
def first_field(self): def first_field(self):
for bf in self.form: if self.form._meta.fields is not None:
return bf name = self.form._meta.fields[0]
return forms.BoundField(self.form, self.form.fields[name], name)
return iter(self.form).next()
def _media(self): def _media(self):
media = self.form.media media = self.form.media