1👍
It’s because the ‘id’ field in OrganizationSerializer is read_only, you can check it yourself in python manage.py shell
test = OrganizationSerializer()
print(repr(test))
0👍
Using tempresdisk’s method above, the serializer should look like this
OrganizationSerializer():
id = IntegerField(label='ID', read_only=True)
...
Overriding that field in the serializer and removing the read_only=True
should do the trick.
class OrganizationSerializer(QueryFieldsMixin, BaseSecuritySerializer):
id = IntegerField(label='ID')
class Meta:
model = Organization
fields = ("id", "name")
depth = 0
- [Answered ]-MIME type ('text/html') is not a supported stylesheet MIME type with react-django heroku deploy
- [Answered ]-How to create or update a model with Django REST Framework?
- [Answered ]-How to add context to the activation_email.txt in Django
- [Answered ]-Update Django app hosted at pythonanywhere
- [Answered ]-How can I show specific users data into the serializer through django?
Source:stackexchange.com