|
1 | 1 | title: django.template.base Parser Example Code |
2 | 2 | category: page |
3 | 3 | slug: django-template-base-parser-examples |
4 | | -sortorder: 500011367 |
| 4 | +sortorder: 500011373 |
5 | 5 | toc: False |
6 | 6 | sidebartitle: django.template.base Parser |
7 | | -meta: Python example code for the Parser class from the django.template.base module of the Django project. |
| 7 | +meta: Example code for understanding how to use the Parser class from the django.template.base module of the Django project. |
8 | 8 |
|
9 | 9 |
|
10 | | -Parser is a class within the django.template.base module of the Django project. |
| 10 | +`Parser` is a class within the `django.template.base` module of the Django project. |
11 | 11 |
|
| 12 | +<a href="/django-template-base-context-examples.html">Context</a>, |
| 13 | +<a href="/django-template-base-filterexpression-examples.html">FilterExpression</a>, |
| 14 | +<a href="/django-template-base-node-examples.html">Node</a>, |
| 15 | +<a href="/django-template-base-nodelist-examples.html">NodeList</a>, |
| 16 | +<a href="/django-template-base-template-examples.html">Template</a>, |
| 17 | +<a href="/django-template-base-templatesyntaxerror-examples.html">TemplateSyntaxError</a>, |
| 18 | +<a href="/django-template-base-textnode-examples.html">TextNode</a>, |
| 19 | +<a href="/django-template-base-token-examples.html">Token</a>, |
| 20 | +<a href="/django-template-base-tokentype-examples.html">TokenType</a>, |
| 21 | +<a href="/django-template-base-variabledoesnotexist-examples.html">VariableDoesNotExist</a>, |
| 22 | +<a href="/django-template-base-variablenode-examples.html">VariableNode</a>, |
| 23 | +and <a href="/django-template-base-token-kwargs-examples.html">token_kwargs</a> |
| 24 | +are several other callables with code examples from the same `django.template.base` package. |
12 | 25 |
|
13 | 26 | ## Example 1 from django-sitetree |
14 | 27 | [django-sitetree](https://github.com/idlesign/django-sitetree) |
@@ -84,7 +97,7 @@ class TreeItemChoiceField(ChoiceField): |
84 | 97 | context.update({'request': object()}) |
85 | 98 |
|
86 | 99 | choices_str = sitetree_tree( |
87 | | -~~ Parser(None), Token(token_type=TOKEN_BLOCK, contents=tree_token) |
| 100 | +~~ Parser([]), Token(token_type=TOKEN_BLOCK, contents=tree_token) |
88 | 101 | ).render(context) |
89 | 102 |
|
90 | 103 | tree_choices = [(ITEMS_FIELD_ROOT_ID, self.root_title)] |
|
0 commit comments