#3182: model instance update() method and QuerySet update_or_create() method
----------------------------------------------------------+-----------------
Reporter: Gary Wilson <[email protected]> | Owner:
gwilson
Status: closed | Milestone: 1.1
beta
Component: Database layer (models, ORM) | Version: SVN
Resolution: wontfix | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
----------------------------------------------------------+-----------------
Changes (by jacob):
* status: new => closed
* resolution: => wontfix
Comment:
OK, this has gone around a few times on django-dev and in person, and it's
clear that we're not reaching a consensus. There's a lot apathy, mostly --
few are arguing strongly for this feature, and few are arguing strongly
against it. So, I'm going to do the BDFL thing and make a decision:
It's pretty clear to me that `update()` is a nonstarter; it's a single
line of code::
def update(self, **kw):
self.objects.filter(pk=self.pk).update(**kw)
So that's out.
How about `update_or_create()`? I personally find the name counter-
intuitive -- it's really `get_and_then_update_or_create()` -- but that's
trivial; a better name could be found. A bigger problem is that it's
nonatomic; we went to great lengths to insure that `get_or_create()`
doesn't suffer from synchronization problems, but we can't do that here.
Given both these problems, and given that they won't exist if people are
forced to write these methods in their own code, I'm marking this wontfix.
--
Ticket URL: <http://code.djangoproject.com/ticket/3182#comment:13>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---