{"action":"created","issue":{"url":"https://api.github.com/repos/gregmuellegger/django-superform/issues/11","labels_url":"https://api.github.com/repos/gregmuellegger/django-superform/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/gregmuellegger/django-superform/issues/11/comments","events_url":"https://api.github.com/repos/gregmuellegger/django-superform/issues/11/events","html_url":"https://github.com/gregmuellegger/django-superform/issues/11","id":124792184,"number":11,"title":"__getitem__ in ModelField does not work","user":{"login":"duduklein","id":2512289,"avatar_url":"https://avatars.githubusercontent.com/u/2512289?v=3","gravatar_id":"","url":"https://api.github.com/users/duduklein","html_url":"https://github.com/duduklein","followers_url":"https://api.github.com/users/duduklein/followers","following_url":"https://api.github.com/users/duduklein/following{/other_user}","gists_url":"https://api.github.com/users/duduklein/gists{/gist_id}","starred_url":"https://api.github.com/users/duduklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duduklein/subscriptions","organizations_url":"https://api.github.com/users/duduklein/orgs","repos_url":"https://api.github.com/users/duduklein/repos","events_url":"https://api.github.com/users/duduklein/events{/privacy}","received_events_url":"https://api.github.com/users/duduklein/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-04T16:37:40Z","updated_at":"2016-01-12T08:04:28Z","closed_at":"2016-01-12T08:03:53Z","body":"Hi, \r\n\r\nFirst of all, thank you for this package. It's really good and useful.\r\n\r\nI have found a bug though:\r\nIn the [FormField's example ](https://django-superform.readthedocs.org/en/latest/fields.html#formfield), the `{{ registration_form.address.street }}` does not work.\r\n\r\nIn python, If I do:\r\n```\r\nfrom django import forms\r\nfrom django_superform import SuperForm, FormField\r\n\r\nclass AddressForm(forms.Form):\r\n    street = forms.CharField()\r\n    city = forms.CharField()\r\n\r\nclass RegistrationForm(SuperForm):\r\n    first_name = forms.CharField()\r\n    last_name = forms.CharField()\r\n    address = FormField(AddressForm)\r\n\r\nrf = RegistrationForm()\r\nad = rf[\"address\"]\r\nad[\"street\"]\r\n```\r\nI get\r\n```\r\nlocal/lib/python2.7/site-packages/django/forms/forms.pyc in __getitem__(self, idx)\r\n    556         # from templates.\r\n    557         if not isinstance(idx, six.integer_types):\r\n--> 558             raise TypeError\r\n    559         return list(self.__iter__())[idx]\r\n    560 \r\n\r\nTypeError: \r\n```\r\n\r\nIn the code, there is a comment stating that overriding __getitem__ is not necessary, but it seems it is according to my tests. Iterating over the `FormField` works fine (the `__iter__` is overridden.\r\n\r\nThanks in advance"},"comment":{"url":"https://api.github.com/repos/gregmuellegger/django-superform/issues/comments/170832240","html_url":"https://github.com/gregmuellegger/django-superform/issues/11#issuecomment-170832240","issue_url":"https://api.github.com/repos/gregmuellegger/django-superform/issues/11","id":170832240,"user":{"login":"gregmuellegger","id":88278,"avatar_url":"https://avatars.githubusercontent.com/u/88278?v=3","gravatar_id":"","url":"https://api.github.com/users/gregmuellegger","html_url":"https://github.com/gregmuellegger","followers_url":"https://api.github.com/users/gregmuellegger/followers","following_url":"https://api.github.com/users/gregmuellegger/following{/other_user}","gists_url":"https://api.github.com/users/gregmuellegger/gists{/gist_id}","starred_url":"https://api.github.com/users/gregmuellegger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregmuellegger/subscriptions","organizations_url":"https://api.github.com/users/gregmuellegger/orgs","repos_url":"https://api.github.com/users/gregmuellegger/repos","events_url":"https://api.github.com/users/gregmuellegger/events{/privacy}","received_events_url":"https://api.github.com/users/gregmuellegger/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T08:04:28Z","updated_at":"2016-01-12T08:04:28Z","body":"Yep, you're absolutely right and identified the right place to fix this. I've added the `CompositeBoundField.__getitem__` method, now it works as advertised. Thanks for the report!"}}