Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial updates always change fields that are not in data, read only, and have a default #3565

Closed
melinath opened this issue Oct 29, 2015 · 9 comments
Labels
Milestone

Comments

@melinath
Copy link

This is kind of an edge case, maybe? Maybe not. I ran into it because I have a field which is readonly on update but has a default for the create case.

See Serializer._writable_fields. I'm trying to do a partial update on one field, but I have another field that's readonly on update. BUT instead of being left alone, since it has a default, it always gets set TO THAT DEFAULT.

From my reading of writable_fields, it looks like this would happen with any field that has a default and isn't included in a partial update, but for it to happen on a read_only field seems particularly egregious to me. :-p

@melinath
Copy link
Author

(My expectation would be that a partial update would only affect the fields that have data being sent their way.)

melinath referenced this issue in dancerfly/django-brambling Oct 29, 2015
… get switched to reserved when moved via the api.
@tomchristie
Copy link
Member

Is this still occurring against the latest release?

@melinath
Copy link
Author

melinath commented Nov 4, 2015

I tried upgrading to the latest stable release (3.3.1) and still had the issue, and I didn't see any changes between that and master in the relevant parts of the code.

@gcbirzan
Copy link
Contributor

gcbirzan commented Jul 5, 2016

This is still present. The documentation (3.0 announcement, which is the only place I could find a reference to this) is also wrong: it doesn't mention that it'll only be used for read_only fields.

@tomchristie tomchristie added this to the 3.4.2 Release milestone Aug 2, 2016
@tomchristie
Copy link
Member

tomchristie commented Aug 2, 2016

Milestoning to confirm against latest version.

@tomchristie
Copy link
Member

Right - thanks for having raised this @melinath, and for having confirmed @gcbirzan.
Fix now incoming.

(Yay for now having a funded project where long-standing issues like this can finally get resolved!)

@MarkusH
Copy link

MarkusH commented Aug 22, 2016

I just updated to a DRF 3.4.5 and noticed this change in behavior between 3.4.1 and 3.4.2. This change is breaking a couple of tests for us and is also changing the semantics of how defaults are treated in DRF.

May I ask to not have such backwards incompatible changes in patch releases in future versions. Thank you.

@tomchristie
Copy link
Member

Sure. That's always a bit more gray when the behavior is classified as a bug, but yes I do think that we'll start being more cautious about any change that affects behavior, even in bug cases, and deferring those to major releases.

@MarkusH
Copy link

MarkusH commented Aug 22, 2016

Thanks @tomchristie 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants