From 89ccbabbfc0964886076fb3ef768a6e57d88e512 Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Fri, 29 Aug 2008 16:07:19 +0000 Subject: [PATCH] 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 --- django/contrib/admin/helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index 613e63e449..7a60943d46 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -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