Skip to content

Commit 63158cd

Browse files
committed
Add BC note for #5886 to 3.8 Release Announcement
1 parent 0b0c862 commit 63158cd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/topics/3.8-announcement.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,28 @@ If you use REST framework commercially and would like to see this work continue,
3333

3434
*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).*
3535

36+
37+
---
38+
39+
## Breaking Changes
40+
41+
### Altered behaviour of `read_only` plus `default` on Field.
42+
43+
[#5886][gh5886]
44+
45+
`read_only` fields will now **always** be excluded from writable fields.
46+
47+
Previously `read_only` fields with a `default` value would use the `default` for create and update operations.
48+
49+
In order to maintain the old behaviour you may need to pass the value of `read_only` fields when calling `save()` in
50+
the view:
51+
52+
def perform_create(self, serializer):
53+
serializer.save(owner=self.request.user)
54+
55+
Alternatively you may override `save()` or `create()` or `update()` on the serialiser as appropriate.
56+
57+
3658
---
3759

3860
## Boolean Composable Permissions
@@ -72,3 +94,4 @@ TODO
7294
TODO
7395

7496
[funding]: funding.md
97+
[gh5886]: https://github.com/encode/django-rest-framework/issues/5886

0 commit comments

Comments
 (0)