toranb/ember-data-django-rest-adapter — pull request #82 by Celc (2014-05-13 21:00:33+00:00)
Title: Enable readOnly attributes and partial sends as PATCH

It's because djangorestframework changes the expected method if we send back a partial update from `PUT` to `PATCH`. Which means a simple attribute serialization override.

App.UserSerializer = DS.DjangoRESTSerializer.extend({
serialize: function(record, options) {
var json = this._super.apply(this, arguments);
delete json.profile_picture;
return json;
}
});

Fails.

Instead adding support for readOnly attributes proposed but not (yet) implemented in https://github.com/emberjs/data/pull/303

App.User = DS.Model.extend({
username: DS.attr('string'),
profile_picture: DS.attr('string', {readOnly: true}),
});

Would serialize the model without the `profile_picture` attribute and send it as a `PATCH`.

I could also submit a pull request to have django-rest-adapter only send across data that has changed, rather than the whole model, in a similar fashion.