Fully agree with Anssi Kääriäinen, the best approach is ``only_fields`` for save()``
On Mar 1, 11:45 pm, Anssi Kääriäinen <anssi.kaariai...@thl.fi> wrote: > On Thursday, March 1, 2012 9:29:34 PM UTC+2, Carl Meyer wrote: > > > <https://gist.github.com/1951748> > > > Thanks for the suggestion. I agree that that's a useful pattern and one > > I frequently use myself. The problem is that the model instance > > namespace is a precious resource, and using up any more of it than we > > already do can easily lead to backwards-compatibility problems. In this > > case, I don't think turning a one-liner into a shorter one-liner > > justifies using up more of that namespace. > > > Carl > > I suggest implementing .save(only_fields=list_of_fields). > > That should not be hard to implement and will not consume the namespace of > models. Signals are fired properly. In addition, update() would be a bit > strange instance method: it updates the specified fields by the kwargs (the > instance's field values do not matter). In addition, after the update the > instance's fields are not updated to reflect what was just saved. > > - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.