List Info

Thread: Model.add() ?




Model.add() ?
country flaguser name
United States
2007-02-28 08:46:44
Responding to Arvind's post on Django developer:  http://tinyurl.com/39d4vc

In some models, I have add() and update()
methods which call save() so I can perform
extra operations.  Since my app knows
whether I want to add vs. update, there's
no extra query involved unless I choose
to make one by asserting the pk does|doesn't
exist.

> which just means, refactoring save() to save() and
> add() which will keep it compatible. Otherwise, may
> I ask why present save() was chosen over save()
> and add() ?

I'm not aware of the design decisions that went into the ORM
(and
don't have an issue with this one), but I could see where
there might
be some advantage with a trio of add/update/save methods, at
the risk
of additional api overhead.

--
Jeff Bauer
Rubicon, Inc.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )