diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2011-04-19 22:06:19 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2011-04-19 22:06:19 +0000 |
| commit | 1286d783110e8b4d1df8068ed0d9093b49cdcaec (patch) | |
| tree | 0cbaaad3f19a45763e402988130906678f68f09b /docs/ref/templates/api.txt | |
| parent | 9587235530b5e3315e3348b1e0d0899ec5408f6d (diff) | |
Fixed #15791 - method to signal that callable objects should not be called in templates
Thanks to ejucovy for the suggestion and patch!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
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 |
