default field argument behaves incorrectly when partial=True
#9969
Unanswered
r-thomson
asked this question in
Potential Issue
Replies: 1 comment 1 reply
-
|
The link you shared from the docs has the following paragraph:
Which seems to document this exact behaviour |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you look at the official documentation for the
defaultargument:When performing a read or a create, this works as expected:
However, when performing a partial update, this doesn't work— the field is not included in the output.
This results in your API's public interface unexpectedly changing when performing partial updates.
This is caused by a bug in
Field.get_attribute(), which callsself.get_default().django-rest-framework/rest_framework/fields.py
Lines 450 to 452 in d6e11ec
However, the implementation for
Field.get_default()raisesSkipField()wheneverpartial is True.django-rest-framework/rest_framework/fields.py
Lines 481 to 483 in d6e11ec
Beta Was this translation helpful? Give feedback.
All reactions