mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Added the ability to force an SQL insert (or force an update) via a model's
save() method. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -399,9 +399,10 @@ class QuerySet(object):
|
||||
"Cannot update a query once a slice has been taken."
|
||||
query = self.query.clone(sql.UpdateQuery)
|
||||
query.add_update_values(kwargs)
|
||||
query.execute_sql(None)
|
||||
rows = query.execute_sql(None)
|
||||
transaction.commit_unless_managed()
|
||||
self._result_cache = None
|
||||
return rows
|
||||
update.alters_data = True
|
||||
|
||||
def _update(self, values):
|
||||
@@ -415,8 +416,8 @@ class QuerySet(object):
|
||||
"Cannot update a query once a slice has been taken."
|
||||
query = self.query.clone(sql.UpdateQuery)
|
||||
query.add_update_fields(values)
|
||||
query.execute_sql(None)
|
||||
self._result_cache = None
|
||||
return query.execute_sql(None)
|
||||
_update.alters_data = True
|
||||
|
||||
##################################################
|
||||
|
||||
Reference in New Issue
Block a user