Providing meaningful error message if you forget many=True. Closes #1914.

This addresses #1914.

We check the instance for beeing either a `list`, `tuple` or `QuerySet`. That should address most cases. We cannot use ducktyping by checking for existence of `__iter__` or similiar things. This would include too many kind of objects e.g. `dict`s  are perfectly fine non-many objects.
The tests catch a AttributeError, yes. But it's not about `__iter__` it's
`char`, an serializer field. I'm not sure but AttributeError would catch
the most cases, yes. I will change that tomorrow.
Am 17.11.2014 23:54 schrieb "Tom Christie" <notifications@github.com>:

> In rest_framework/serializers.py:
>
> > @@ -152,7 +154,21 @@ def is_valid(self, raise_exception=False):
> >      def data(self):
> >          if not hasattr(self, '_data'):
> >              if self.instance is not None and not getattr(self, '_errors', None):
> > -                self._data = self.to_representation(self.instance)
> > +                try:
> > +                    self._data = self.to_representation(self.instance)
>
> Any chance we can figure out a more specific exception to catch?
> Presumable we'll get an '*iter*' AttributeError in most cases.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/tomchristie/django-rest-framework/pull/2074/files#r20472486>
> .
>