tomchristie/django-rest-framework — pull request #1234 by xordoquy (2013-11-17 00:31:40+00:00)
Title: Fixed the nested model serializers in case of the related_name isn’t set...

Fixed a bug where the writable nested serializers wouldn't work if the related_name wasn't explicitly set.
This is because obj.field.related_query_name() would return classname instead of classname_set leading to the serializers complaining with:

```
ERROR: test_second_nested_level (rest_framework.tests.test_serializer_nested.NestedModelSerializerUpdateTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "rest_framework/runtests/../../rest_framework/tests/test_serializer_nested.py", line 353, in test_second_nested_level
self.assertTrue(deserialize.is_valid())
File "rest_framework/runtests/../../rest_framework/serializers.py", line 515, in is_valid
return not self.errors
File "rest_framework/runtests/../../rest_framework/serializers.py", line 507, in errors
ret = self.from_native(data, files)
File "rest_framework/runtests/../../rest_framework/serializers.py", line 922, in from_native
instance = super(ModelSerializer, self).from_native(data, files)
File "rest_framework/runtests/../../rest_framework/serializers.py", line 348, in from_native
return self.restore_object(attrs, instance=getattr(self, 'object', None))
File "rest_framework/runtests/../../rest_framework/serializers.py", line 906, in restore_object
instance = self.opts.model(**attrs)
File "/Users/xordoquy/.virtualenvs/django-rest-framework/lib/python2.7/site-packages/django/db/models/base.py", line 415, in __init__
raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'blogpost_set' is an invalid keyword argument for this function
```