After doing some digging in the rest framework source, it looks like whenever a python property that is implemented as a data descriptor, such as using @property is discovered in a set of fields, a ReadOnlyField is always generated.
Why is it the case that we are generating read only fields by default, when a descriptor could have a valid __set__ defined?
I understand that a common case is just using @property and not defining a setter, and by doing so __set__ raises an AttributeError. Would it be too messy to try to determine if a valid setter has been defined and if so make the field writable as opposed to read only?
@property doesn't tell which sort of writable field you would need.
Therefore you need to write an explicit serializer field which means DRF doesn't need to figure whether or not the field is writable.
Most helpful comment
@property doesn't tell which sort of writable field you would need.
Therefore you need to write an explicit serializer field which means DRF doesn't need to figure whether or not the field is writable.