1
0
mirror of https://github.com/django/django.git synced 2024-12-23 09:36:06 +00:00

When a form in the admin has no fields prevent failure.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8698 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner 2008-08-29 16:07:19 +00:00
parent b5da9e8b2d
commit 89ccbabbfc

View File

@ -23,7 +23,10 @@ class AdminForm(object):
if self.form._meta.fields is not None:
name = self.form._meta.fields[0]
return forms.BoundField(self.form, self.form.fields[name], name)
return iter(self.form).next()
try:
return iter(self.form).next()
except StopIteration:
return None
def _media(self):
media = self.form.media