Request Method: | POST |
---|---|
Request URL: | http://127.0.0.1:8000/setProfile/ |
Django Version: | 1.8 |
Exception Type: | TypeError |
Exception Value: | argument of type 'ReadOnlyField' is not iterable |
Exception Location: | /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/rest_framework/serializers.py in _get_model_fields, line 1243 |
Python Executable: | /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 |
Python Version: | 3.4.3 |
Python Path: | ['/Users/PycharmProjects/screens', '/Users/PycharmProjects/screens', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages' Appreciate any input on how to troubleshoot this. - Shekar |
class UserPrefSerializer(serializers.ModelSerializer):
class Meta:
owner = serializers.ReadOnlyField(source='owner.username')
model = UserPrefs
fields = (owner, 'name', 'value')
depth = 1
class Meta:
owner = serializers.ReadOnlyField(source='owner.username')
model = UserPrefs
fields = ('owner', 'name', 'value')
depth = 1
I get a error: {"value":["This field is required."]}