diff options
Diffstat (limited to 'docs/ref/templates/api.txt')
| -rw-r--r-- | docs/ref/templates/api.txt | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt index a6cc162f8d..c997a3c279 100644 --- a/docs/ref/templates/api.txt +++ b/docs/ref/templates/api.txt @@ -207,8 +207,9 @@ straight lookups. Here are some things to keep in mind: To prevent this, set an ``alters_data`` attribute on the callable variable. The template system won't call a variable if it has - ``alters_data=True`` set. The dynamically-generated - :meth:`~django.db.models.Model.delete` and + ``alters_data=True`` set, and will instead replace the variable with + :setting:`TEMPLATE_STRING_IF_INVALID`, unconditionally. The + dynamically-generated :meth:`~django.db.models.Model.delete` and :meth:`~django.db.models.Model.save` methods on Django model objects get ``alters_data=True`` automatically. Example:: @@ -216,6 +217,15 @@ straight lookups. Here are some things to keep in mind: self.database_record.delete() sensitive_function.alters_data = True + * .. versionadded:: 1.4 + Occasionally you may want to turn off this feature for other reasons, + and tell the template system to leave a variable un-called no matter + what. To do so, set a ``do_not_call_in_templates`` attribute on the + callable with the value ``True``. The template system then will act as + if your variable is not callable (allowing you to access attributes of + the callable, for example). + + .. _invalid-template-variables: How invalid variables are handled |
