Open erikcw opened 10 years ago
Hi, I'm looking at the same behavior too. Is it possible?
In my case what I ended up doing was nesting serializers. Something like this.
class MyDictSerializer(serializers.Serializer):
"""
This serializer represents my dictionary data
"""
name = serializers.CharField()
username = serializers.CharField()
id = serializers.IntegerField()
class MyModel(serializers.ModelSerializer):
my_field = MyDictSerializer(many=True)
#...etc
The nice thing about this approach is that validators can be attached to MyDictSerializer
. Seems to work pretty well.
Just letting you know I'm not ignoring this. I plan to look at this over this weekend and see what we should do for this. At a glance at seems reasonable to me.
@erikcw How important is it for you that this be fixed for compatibility with rest-framework 2.X, as opposed to when I upgrade this for rest-framework 3.0 (hopefully soon)?
Please see #27
It would be very useful to be able to nest compound fields, such as a DictField inside of a ListField.
In my testing, this didn't seem to currently be possible. Is there a reason why it isn't supported?