diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-09-06 00:01:44 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-09-06 00:01:44 +0000 |
| commit | e131e400e00d668a169a65427566e65725437d73 (patch) | |
| tree | 6ec6ff5d63a553e514c59946de21e6a4ba7d0f76 /docs/templates_python.txt | |
| parent | 096ad32c845f850278b942d087e607dc4311b5f9 (diff) | |
Made small cleanups to [623]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@624 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/templates_python.txt')
| -rw-r--r-- | docs/templates_python.txt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/docs/templates_python.txt b/docs/templates_python.txt index 36ffcbffa3..7144255876 100644 --- a/docs/templates_python.txt +++ b/docs/templates_python.txt @@ -136,7 +136,7 @@ Here are a few examples:: "The first stooge in the list is Larry." If a variable doesn't exist, the template system fails silently. The variable -is replaced with an empty string. +is replaced with an empty string:: >>> t = Template("My name is {{ my_name }}.") >>> c = Context({"foo": "bar"}) @@ -187,7 +187,11 @@ some things to keep in mind: The template system won't execute a method if the method has ``alters_data=True`` set. The dynamically-generated ``delete()`` and ``save()`` methods on Django model objects get ``alters_data=True`` - automatically. + automatically. Example:: + + def sensitive_function(self): + self.database_record.delete() + sensitive_function.alters_data = True Loading templates ----------------- @@ -218,7 +222,7 @@ Django has two ways to load templates from files: ``django.core.template_loader.get_template(template_name)`` ``get_template`` returns the compiled template (a ``Template`` object) for - the given name. If the template doesn't exist, it raises + the template with the given name. If the template doesn't exist, it raises ``django.core.template.TemplateDoesNotExist``. ``django.core.template_loader.select_template(template_name_list)`` |
