From 4c2d6b9bb751c41a4e240811dc66664e00203481 Mon Sep 17 00:00:00 2001 From: Thodoris Sotiropoulos Date: Thu, 17 Nov 2016 18:51:22 +0200 Subject: [PATCH 1/9] Do not ignore source when building fields dynamically This commit fixes the issue when you set the keyword argument `source` and your have not set the serializer fields explicitly. Then the construction of field failed because there is not actually any model field with that name. However, you are still able to imply the name of model field by providing the `source` keyword argument. --- rest_framework/serializers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 02c24b70e..fda57bfb0 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -995,13 +995,15 @@ class ModelSerializer(Serializer): fields[field_name] = declared_fields[field_name] continue + extra_field_kwargs = extra_kwargs.get(field_name, {}) + source = extra_field_kwargs.get('source') or field_name + # Determine the serializer field class and keyword arguments. field_class, field_kwargs = self.build_field( - field_name, info, model, depth + source, info, model, depth ) # Include any kwargs defined in `Meta.extra_kwargs` - extra_field_kwargs = extra_kwargs.get(field_name, {}) field_kwargs = self.include_extra_kwargs( field_kwargs, extra_field_kwargs ) From 60bb3b09584d9126b29c6dc902e03fa2e61431ef Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 10 Mar 2017 06:30:31 +0100 Subject: [PATCH 2/9] Updated funding page --- docs/index.md | 3 +- docs/topics/funding.md | 69 ++++++++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/docs/index.md b/docs/index.md index 73026605b..13edf08dd 100644 --- a/docs/index.md +++ b/docs/index.md @@ -67,8 +67,7 @@ REST framework is a *collaboratively funded project*. If you use REST framework commercially we strongly encourage you to invest in its continued development by **[signing up for a paid plan][funding]**. -The initial aim is to provide a single full-time position on REST framework. -*Every single sign-up makes a significant impact towards making that possible.* +*Every single sign-up helps us make REST framework long-term financially sustainable.*