Author: jacob
Date: 2008-08-28 15:48:59 -0500 (Thu, 28 Aug 2008)
New Revision: 8681

Modified:
   django/trunk/django/contrib/admin/helpers.py
Log:
Fixed #8194: `AdminForm.first_field` now correctly returns the first field when 
using custom field orders.

Modified: django/trunk/django/contrib/admin/helpers.py
===================================================================
--- django/trunk/django/contrib/admin/helpers.py        2008-08-28 20:20:40 UTC 
(rev 8680)
+++ django/trunk/django/contrib/admin/helpers.py        2008-08-28 20:48:59 UTC 
(rev 8681)
@@ -20,8 +20,10 @@
             yield Fieldset(self.form, name, **options)
 
     def first_field(self):
-        for bf in self.form:
-            return bf
+        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()
 
     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
-~----------~----~----~----~------~----~------~--~---

Reply via email to