[Answered ]-Django-rest framework structure not capturing post or put request

2👍

Your serializer has no writable fields.

fields = ('id','attribute')

You define it there to only have two attributes, the first of which is the id, and the second being a read-only attribute. Both get logically ignored when writing (id is overridden from the url and read-only is, well, read-only).

If you want to be able to write other fields, you must include them as well. If you still don’t want them output when you GET the object, you may add them as write-only fields:

    fields = ('id', 'attribute', 'foo', 'bar')
    extra_kwargs = {
        'foo': {'write_only': True},
        'bar': {'write_only': True},
    }

Leave a comment