adr...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed a7abcba

Changed FormWrapper.fields (from [1253]) to be a property, so that it's only called when needed.

  • Participants
  • Parent commits ff8fd99

Comments (0)

Files changed (1)

File django/core/

     def __init__(self, manipulator, data, error_dict):
         self.manipulator, = manipulator, data
         self.error_dict = error_dict
-        self.fields = [self.__getitem__(field.field_name) for field in self.manipulator.fields]
     def __repr__(self):
         return repr(
     def has_errors(self):
         return self.error_dict != {}
+    def _get_fields(self):
+        try:
+            return self._fields
+        except AttributeError:
+            self._fields = [self.__getitem__(field.field_name) for field in self.manipulator.fields]
+            return self._fields
+    fields = property(_get_fields)
 class FormFieldWrapper:
     "A bridge between the template system and an individual form field. Used by FormWrapper."
     def __init__(self, formfield, data, error_list):