Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 89ccbabbfc0964886076fb3ef768a6e57d88e512 1 parent b5da9e8
@brosner brosner authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/contrib/admin/helpers.py
View
5 django/contrib/admin/helpers.py
@@ -23,7 +23,10 @@ def first_field(self):
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

0 comments on commit 89ccbab

Please sign in to comment.
Something went wrong with that request. Please try again.