1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #34148 -- Reverted "Fixed #32901 -- Optimized BaseForm.__getitem__()."

This reverts commit edde2a0699.

Thanks Jan Pieter Waagmeester for the report.
This commit is contained in:
Francesco Panico
2022-11-17 22:45:06 +01:00
committed by Mariusz Felisiak
parent fbde929b19
commit 51faf4bd17
3 changed files with 20 additions and 7 deletions

View File

@@ -174,10 +174,6 @@ class BaseForm(RenderableFormMixin):
def __getitem__(self, name):
"""Return a BoundField with the given name."""
try:
return self._bound_fields_cache[name]
except KeyError:
pass
try:
field = self.fields[name]
except KeyError:
@@ -189,9 +185,9 @@ class BaseForm(RenderableFormMixin):
", ".join(sorted(self.fields)),
)
)
bound_field = field.get_bound_field(self, name)
self._bound_fields_cache[name] = bound_field
return bound_field
if name not in self._bound_fields_cache:
self._bound_fields_cache[name] = field.get_bound_field(self, name)
return self._bound_fields_cache[name]
@property
def errors(self):