Re: similar method for get_or_create()

2008-07-22 Thread pihentagy
Hi! I also have the same issue. I should write: pp, pp_created = WSProductPurchase.objects.get_or_create(purchase=purchase, ws_product=ws_product, defaults=dict(quantity=quantity)) if not pp_created: pp.quantity = quantity pp.save() I suspect lepp

Re: similar method for get_or_create()

2008-07-18 Thread Malcolm Tredinnick
On Fri, 2008-07-18 at 02:57 -0700, leppy wrote: > hi everyone, > > Can anyone tell me a method similar to django model's get_or_create > for updating an object with a particular id only when it exists, or > else to create a new object. That's exactly what the save() method on a model does. Per

Re: similar method for get_or_create()

2008-07-18 Thread R. Gorman
Why do you need a method other than get_or_create? Could you not try to retrieve the object using get_or_create and then update the object if retrieved? R. On Jul 18, 5:57 am, leppy <[EMAIL PROTECTED]> wrote: > hi everyone, > > Can anyone tell me a method similar to django model's get_or_create

similar method for get_or_create()

2008-07-18 Thread leppy
hi everyone, Can anyone tell me a method similar to django model's get_or_create for updating an object with a particular id only when it exists, or else to create a new object. Thanks in advance. leppy. --~--~-~--~~~---~--~~ You received this message because you