summaryrefslogtreecommitdiff
path: root/docs/model-api.txt
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-05-05 18:31:16 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-05-05 18:31:16 +0000
commit3f932e31dc4f1c4146ed42f7dc8ca7154b06481a (patch)
tree3a05fe8ced3510c693e9349efcbe39ae8ac67b02 /docs/model-api.txt
parenta0872543a7d1cbcb4576ef3d41ef413edf89e3c1 (diff)
Fixed #1773 -- Fixed indentation error in docs/model-api.txt. Thanks, pb
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2849 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/model-api.txt')
-rw-r--r--docs/model-api.txt30
1 files changed, 15 insertions, 15 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 6b8e168fd4..a807efc0d6 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -1484,23 +1484,23 @@ For example, this model has a few custom methods::
city = models.CharField(maxlength=50)
state = models.USStateField() # Yes, this is America-centric...
- def baby_boomer_status(self):
- "Returns the person's baby-boomer status."
- import datetime
- if datetime.date(1945, 8, 1) <= self.birth_date <= datetime.date(1964, 12, 31):
- return "Baby boomer"
- if self.birth_date < datetime.date(1945, 8, 1):
- return "Pre-boomer"
- return "Post-boomer"
+ def baby_boomer_status(self):
+ "Returns the person's baby-boomer status."
+ import datetime
+ if datetime.date(1945, 8, 1) <= self.birth_date <= datetime.date(1964, 12, 31):
+ return "Baby boomer"
+ if self.birth_date < datetime.date(1945, 8, 1):
+ return "Pre-boomer"
+ return "Post-boomer"
- def is_midwestern(self):
- "Returns True if this person is from the Midwest."
- return self.state in ('IL', 'WI', 'MI', 'IN', 'OH', 'IA', 'MO')
+ def is_midwestern(self):
+ "Returns True if this person is from the Midwest."
+ return self.state in ('IL', 'WI', 'MI', 'IN', 'OH', 'IA', 'MO')
- def _get_full_name(self):
- "Returns the person's full name."
- return '%s %s' % (self.first_name, self.last_name)
- full_name = property(_get_full_name)
+ def _get_full_name(self):
+ "Returns the person's full name."
+ return '%s %s' % (self.first_name, self.last_name)
+ full_name = property(_get_full_name)
The last method in this example is a *property*. `Read more about properties`_.