diff options
| -rw-r--r-- | rest_framework/serializers.py | 9 | ||||
| -rw-r--r-- | tests/test_authentication.py | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 2d5c843e..00362dbb 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -86,6 +86,15 @@ class BaseSerializer(Field): class when `many=True` is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child. + + Note that we're over-cautious in passing most arguments to both parent + and child classes in order to try to cover the general case. If you're + overriding this method you'll probably want something much simpler, eg: + + @classmethod + def many_init(cls, *args, **kwargs): + kwargs['child'] = cls() + return CustomListSerializer(*args, **kwargs) """ child_serializer = cls(*args, **kwargs) list_kwargs = {'child': child_serializer} diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 32041f9c..28c3a8b3 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -142,7 +142,7 @@ class SessionAuthTests(TestCase): cf. [#1810](https://github.com/tomchristie/django-rest-framework/pull/1810) """ response = self.csrf_client.get('/auth/login/') - self.assertContains(response, '<Label class="span4">Username:</label>') + self.assertContains(response, '<label class="span4">Username:</label>') def test_post_form_session_auth_failing_csrf(self): """ |
