Fixed #2141 -- corrected indentation problems in a couple of the code fragments.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3126 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2006-06-14 03:34:52 +00:00
parent 97fedcc031
commit ed1dcbf3e7
1 changed files with 9 additions and 9 deletions

View File

@ -1634,10 +1634,10 @@ to happen whenever you save an object. For example::
name = models.CharField(maxlength=100) name = models.CharField(maxlength=100)
tagline = models.TextField() tagline = models.TextField()
def save(self): def save(self):
do_something() do_something()
super(Blog, self).save() # Call the "real" save() method. super(Blog, self).save() # Call the "real" save() method.
do_something_else() do_something_else()
You can also prevent saving:: You can also prevent saving::
@ -1645,11 +1645,11 @@ You can also prevent saving::
name = models.CharField(maxlength=100) name = models.CharField(maxlength=100)
tagline = models.TextField() tagline = models.TextField()
def save(self): def save(self):
if self.name == "Yoko Ono's blog": if self.name == "Yoko Ono's blog":
return # Yoko shall never have her own blog! return # Yoko shall never have her own blog!
else: else:
super(Blog, self).save() # Call the "real" save() method. super(Blog, self).save() # Call the "real" save() method.
.. _database API docs: http://www.djangoproject.com/documentation/db_api/ .. _database API docs: http://www.djangoproject.com/documentation/db_api/