diff options
Diffstat (limited to 'docs/ref/utils.txt')
| -rw-r--r-- | docs/ref/utils.txt | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 8ebb4f5116..3e357cba17 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -469,8 +469,7 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 class Person(models.Model): @cached_property - def friends(self): - ... + def friends(self): ... Note that as the method is now a property, in Python code it will need to be accessed appropriately:: @@ -552,8 +551,7 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 # Or more succinctly: @keep_lazy(str) - def fancy_utility_function(s, *args, **kwargs): - ... + def fancy_utility_function(s, *args, **kwargs): ... The ``keep_lazy()`` decorator takes a number of extra arguments (``*args``) specifying the type(s) that the original function can return. A common @@ -578,14 +576,12 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 # Our previous example was: @keep_lazy(str) - def fancy_utility_function(s, *args, **kwargs): - ... + def fancy_utility_function(s, *args, **kwargs): ... # Which can be rewritten as: @keep_lazy_text - def fancy_utility_function(s, *args, **kwargs): - ... + def fancy_utility_function(s, *args, **kwargs): ... ``django.utils.html`` ===================== |
