Ticket #18361: form_widget_iteration.diff

File form_widget_iteration.diff, 494 bytes (added by kmichel_wgs, 3 years ago)
  • django/forms/forms.py

    diff --git a/django/forms/forms.py b/django/forms/forms.py
    index 09663d1..2957063 100644
    a b class BoundField(StrAndUnicode): 
    424424        return len(list(self.__iter__()))
    425425
    426426    def __getitem__(self, idx):
    427         return list(self.__iter__())[idx]
     427        if isinstance(idx, int):
     428            return list(self.__iter__())[idx]
     429        else:
     430            raise AttributeError(idx)
    428431
    429432    def _errors(self):
    430433        """
Back to Top