summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-08-26 03:06:22 +0300
committerTim Graham <timograham@gmail.com>2016-08-25 20:06:22 -0400
commita02b5848ae6025ad3ef12cf6646ffd3e82a66067 (patch)
treee42106ba668d13fda3fa0f1880e527027f3154c6 /docs
parentebdfd656b482ecb503c481bfba8579d40a1f1809 (diff)
Replaced property() usage with decorator in several places.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/db/models.txt4
-rw-r--r--docs/topics/forms/media.txt4
2 files changed, 4 insertions, 4 deletions
diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
index d08d044979..e8468cd26c 100644
--- a/docs/topics/db/models.txt
+++ b/docs/topics/db/models.txt
@@ -751,10 +751,10 @@ For example, this model has a few custom methods::
else:
return "Post-boomer"
- def _get_full_name(self):
+ @property
+ def 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 :term:`property`.
diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt
index 1e2345ba20..adbd2c377e 100644
--- a/docs/topics/forms/media.txt
+++ b/docs/topics/forms/media.txt
@@ -188,10 +188,10 @@ For example, the static definition for our Calendar Widget could also
be defined in a dynamic fashion::
class CalendarWidget(forms.TextInput):
- def _media(self):
+ @property
+ def media(self):
return forms.Media(css={'all': ('pretty.css',)},
js=('animations.js', 'actions.js'))
- media = property(_media)
See the section on `Media objects`_ for more details on how to construct
return values for dynamic ``media`` properties.