tomchristie/django-rest-framework — pull request #1343 by xordoquy (2014-01-09 22:35:20+00:00)
Title: Fix for #1129

In the end, I removed the try/except that wasn't used due to the if condition before.
I don't catch the exception in the case of an non existent field as the current traceback looks clear enough:

----------------------------------------------------------------------
Traceback (most recent call last):
File "./rest_framework/runtests/../../rest_framework/tests/test_relations.py", line 120, in test_exception_for_incorect_fk
TestSerializer(data={'name': 'foo'})
File "./rest_framework/runtests/../../rest_framework/serializers.py", line 174, in __init__
self.fields = self.get_fields()
File "./rest_framework/runtests/../../rest_framework/serializers.py", line 230, in get_fields
field.initialize(parent=self, field_name=key)
File "./rest_framework/runtests/../../rest_framework/relations.py", line 69, in initialize
manager = getattr(self.parent.opts.model, self.source or field_name)
AttributeError: type object 'ManyToManySource' has no attribute 'banzai'