Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 3f932e31dc4f1c4146ed42f7dc8ca7154b06481a 1 parent a087254
@adrianholovaty adrianholovaty authored
Showing with 17 additions and 17 deletions.
  1. +17 −17 docs/model-api.txt
View
34 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 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 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 _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`_.
Please sign in to comment.
Something went wrong with that request. Please try again.