From 63158cd185e6ef907a2175114a3cce1cb7210543 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 20 Mar 2018 21:05:56 +0100 Subject: [PATCH] Add BC note for #5886 to 3.8 Release Announcement --- docs/topics/3.8-announcement.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/topics/3.8-announcement.md b/docs/topics/3.8-announcement.md index 7b137006da..857cdf8bc9 100644 --- a/docs/topics/3.8-announcement.md +++ b/docs/topics/3.8-announcement.md @@ -33,6 +33,28 @@ If you use REST framework commercially and would like to see this work continue, *We'd like to say thanks in particular our premium backers, [Rover](http://jobs.rover.com/), [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [Machinalis](https://hello.machinalis.co.uk/), and [Rollbar](https://rollbar.com).* + +--- + +## Breaking Changes + +### Altered behaviour of `read_only` plus `default` on Field. + +[#5886][gh5886] + +`read_only` fields will now **always** be excluded from writable fields. + +Previously `read_only` fields with a `default` value would use the `default` for create and update operations. + +In order to maintain the old behaviour you may need to pass the value of `read_only` fields when calling `save()` in +the view: + + def perform_create(self, serializer): + serializer.save(owner=self.request.user) + +Alternatively you may override `save()` or `create()` or `update()` on the serialiser as appropriate. + + --- ## Boolean Composable Permissions @@ -72,3 +94,4 @@ TODO TODO [funding]: funding.md +[gh5886]: https://github.com/encode/django-rest-framework/issues/5886