Author: brosner
Date: 2008-08-29 11:07:19 -0500 (Fri, 29 Aug 2008)
New Revision: 8698
Modified:
django/trunk/django/contrib/admin/helpers.py
Log:
When a form in the admin has no fields prevent failure.
Modified: django/trunk/django/contrib/admin/helpers.py
===================================================================
--- django/trunk/django/contrib/admin/helpers.py 2008-08-29 15:45:23 UTC
(rev 8697)
+++ django/trunk/django/contrib/admin/helpers.py 2008-08-29 16:07:19 UTC
(rev 8698)
@@ -23,7 +23,10 @@
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---