make model.save() take kw params

2007-06-12 Thread Amit Upadhyay
Hi, Wouldn't it be cool if we can say user.save(email="[EMAIL PROTECTED]"), which will do the equivalent of user.email = "[EMAIL PROTECTED]"; user.save()? Should be single line change, putting a self.__dict__.update(kw) in model.save(). -- Amit Upadhyay Vakow! www.vakow.com +91-9820-295-512 --~

Re: make model.save() take kw params

2007-06-12 Thread Brian Harring
On Wed, Jun 13, 2007 at 12:11:29AM +0530, Amit Upadhyay wrote: >Hi, >Wouldn't it be cool if we can say >user.save(email="[EMAIL PROTECTED]"), which will do the >equivalent of user.email = "[2] [EMAIL PROTECTED]"; user.save()? Not really, no. :) Save is simple; why make it more com

Re: make model.save() take kw params

2007-06-12 Thread Marty Alchin
Also, consider the semantics of that function call. It's obvious that the new email would be saved to the database, but it's not obvious that it would be updated on the object as well. I would personally expect something like user.save(email='[EMAIL PROTECTED]') to bypass the current object, inste

Re: make model.save() take kw params

2007-06-12 Thread Jacob Kaplan-Moss
See http://code.djangoproject.com/ticket/3182 -- that's the way we decided on some months ago; it just fell off my radar. Thanks for the reminder :) Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django dev

Re: make model.save() take kw params

2007-06-12 Thread Malcolm Tredinnick
On Wed, 2007-06-13 at 00:11 +0530, Amit Upadhyay wrote: > Hi, > > Wouldn't it be cool if we can say > user.save(email="[EMAIL PROTECTED]"), which will do the equivalent > of user.email = "[EMAIL PROTECTED]"; user.save()? Should be single > line change, putting a self.__dict__.update(kw) in model.

Re: make model.save() take kw params

2007-06-13 Thread Amit Upadhyay
On 6/13/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Wed, 2007-06-13 at 00:11 +0530, Amit Upadhyay wrote: > > Hi, > > > > Wouldn't it be cool if we can say > > user.save(email="[EMAIL PROTECTED]"), which will do the equivalent > > of user.email = "[EMAIL PROTECTED]"; user.save()? Shou

Re: make model.save() take kw params

2007-06-13 Thread Malcolm Tredinnick
On Wed, 2007-06-13 at 14:42 +0530, Amit Upadhyay wrote: [...] > > > > Utility functions like create_or_update() are just that: > intentional > combinations of the two and you need to be able to handle both > types of > errors, but you know what you are ge