Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated a few save() methods on models to accept force_insert and for…

…ce_update

parameters. Required as a consequence of [8670] (so they can be used with
create()).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8673 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 65c0846c4561130eda98d6f98d7778453960e94a 1 parent a46d3eb
@malcolmt malcolmt authored
View
8 django/contrib/comments/models.py
@@ -74,10 +74,10 @@ class Meta:
def __unicode__(self):
return "%s: %s..." % (self.name, self.comment[:50])
- def save(self):
+ def save(self, force_insert=False, force_update=False):
if self.submit_date is None:
self.submit_date = datetime.datetime.now()
- super(Comment, self).save()
+ super(Comment, self).save(force_insert, force_update)
def _get_userinfo(self):
"""
@@ -178,7 +178,7 @@ def __unicode__(self):
return "%s flag of comment ID %s by %s" % \
(self.flag, self.comment_id, self.user.username)
- def save(self):
+ def save(self, force_insert=False, force_update=False):
if self.flag_date is None:
self.flag_date = datetime.datetime.now()
- super(CommentFlag, self).save()
+ super(CommentFlag, self).save(force_insert, force_update)
View
2  django/contrib/sites/models.py
@@ -64,7 +64,7 @@ def __init__(self, request):
def __unicode__(self):
return self.domain
- def save(self):
+ def save(self, force_insert=False, force_update=False):
raise NotImplementedError('RequestSite cannot be saved.')
def delete(self):
View
5 tests/modeltests/save_delete_hooks/models.py
@@ -14,9 +14,10 @@ class Person(models.Model):
def __unicode__(self):
return u"%s %s" % (self.first_name, self.last_name)
- def save(self):
+ def save(self, force_insert=False, force_update=False):
print "Before save"
- super(Person, self).save() # Call the "real" save() method
+ # Call the "real" save() method
+ super(Person, self).save(force_insert, force_update)
print "After save"
def delete(self):
View
4 tests/regressiontests/bug639/models.py
@@ -16,8 +16,8 @@ def __init__(self, *args, **kwargs):
super(Photo, self).__init__(*args, **kwargs)
self._savecount = 0
- def save(self):
- super(Photo, self).save()
+ def save(self, force_insert=False, force_update=False):
+ super(Photo, self).save(force_insert, force_update)
self._savecount += 1
class PhotoForm(ModelForm):
View
4 tests/regressiontests/extra_regress/models.py
@@ -13,8 +13,8 @@ class RevisionableModel(models.Model):
def __unicode__(self):
return u"%s (%s, %s)" % (self.title, self.id, self.base.id)
- def save(self):
- super(RevisionableModel, self).save()
+ def save(self, force_insert=False, force_update=False):
+ super(RevisionableModel, self).save(force_insert, force_update)
if not self.base:
self.base = self
super(RevisionableModel, self).save()
Please sign in to comment.
Something went wrong with that request. Please try again.