beda-software / drf-writable-nested

Writable nested model serializer for Django REST Framework
Other
1.07k stars 116 forks source link

Using SerializerMethodField with WritableNestedModelSerializer #123

Open Mohamed-Kaizen opened 4 years ago

Mohamed-Kaizen commented 4 years ago

i try to use SerializerMethodField with WritableNestedModelSerializer but it's not working

class BinCreateUpdateSerializer(WritableNestedModelSerializer):
    """Serializer for creation and update bin model."""
    warehouse = serializers.SerializerMethodField()
    def get_warehouse(self, obj):
        print(obj)
        return obj

the method never called