diff options
| author | Tim Graham <timograham@gmail.com> | 2012-11-23 04:12:54 -0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2012-11-23 04:12:54 -0800 |
| commit | 9d4baf80c6b701bc6fe975fce3011f1388aeb046 (patch) | |
| tree | b69164abbfb1ce98a4aa1ff97698c91749e1bd9d /docs | |
| parent | 63e6cd1bb3edccb4db1eb6a79153fa31d2114cd4 (diff) | |
| parent | eabb44417ce1842007719b4b9378acca0e668b45 (diff) | |
Merge pull request #549 from WoLpH/master
Changed an if statement in the docs to a slightly cleaner variant.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/db/models.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt index 84b4c84061..2f1676ac1a 100644 --- a/docs/topics/db/models.txt +++ b/docs/topics/db/models.txt @@ -673,11 +673,12 @@ For example, this model has a few custom methods:: 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" + elif self.birth_date < datetime.date(1965, 1, 1): + return "Baby boomer" + else: + return "Post-boomer" def is_midwestern(self): "Returns True if this person is from the Midwest." |
