Read only fields
Currently DjangoLDP model fields can't be made read-only by the serializer or the admin panel
The easiest way to make a field read-only in the serializer is to extend it and set DRF's read_only_fields
In the past (with auto_author
) this was achieved by overriding get_default_field_names
: https://git.startinblox.com/djangoldp-packages/djangoldp/blob/5f6b29fd323bc835d77bc8ceadee09a0646f69a8/djangoldp/serializers.py#L274
For the admin case we could create a DjangoLDPAdmin
and override get_readonly_fields (overriding this instead of using the built-in readonly_fields to allow users to add their own fields without breaking anything)