Hello! 
I have a model with HStoreField:

When I try view in browser I get:

AttributeError at /records/

'str' object has no attribute 'items'


I set the breakpoint on *to_representaion* method in *DictField and I see:*

def to_representation(self, value):                    *self: 
CharMappingField() value: ' "key"=>"value" '*
    """
    List of object instances -> List of dicts of primitive datatypes.
    """
    return {
        six.text_type(key): self.child.to_representation(val) if val is not 
None else None
        for key, val in value.items()
    }


value is string, but must be dict.

It is a model and serializer:

class Test(models.Model):
    attempts = HStoreField()


class TestSerializer(serializers.ModelSerializer):
    class Meta:
        model = Test
        fields = '__all__'



Django version (1.11), Rest Framefork (3.6.2)
Thanks for any help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to