more tests
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
==================
|
||||
Comment Basic
|
||||
==================
|
||||
|
||||
{% comment %}
|
||||
This is ignored
|
||||
{% endcomment %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(comment_group
|
||||
(comment_content))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Comment Empty
|
||||
==================
|
||||
|
||||
{% comment %}{% endcomment %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(comment_group)
|
||||
(content))
|
||||
|
||||
==================
|
||||
Comment With Note
|
||||
==================
|
||||
|
||||
{% comment "why" %}
|
||||
This is ignored
|
||||
{% endcomment %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(comment_group
|
||||
(string)
|
||||
(comment_content))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Comment Ignores Tag Like Text
|
||||
==================
|
||||
|
||||
{% comment %}
|
||||
Contains {% if x %} tag-like text
|
||||
{% endcomment %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(comment_group
|
||||
(comment_content))
|
||||
(content))
|
||||
@@ -87,3 +87,57 @@ other
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
If With Complex Predicate
|
||||
==================
|
||||
|
||||
{% if not done and count in valid_counts and status is not none or tags|length >= 3 %}
|
||||
yes
|
||||
{% endif %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(if_group
|
||||
(predicate
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))
|
||||
(filter_expression
|
||||
(filter)))
|
||||
(binaryOperator)
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
==================
|
||||
Partial Basic
|
||||
==================
|
||||
|
||||
{% partial header %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(partial
|
||||
name: (identifier))
|
||||
(content))
|
||||
@@ -0,0 +1,41 @@
|
||||
==================
|
||||
Partialdef Basic
|
||||
==================
|
||||
|
||||
<div>
|
||||
{% partialdef header %}
|
||||
<h1>Title</h1>
|
||||
{% endpartialdef %}
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(partialdef_group
|
||||
name: (push_partial)
|
||||
(template
|
||||
(content))
|
||||
(pop_partial))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Partialdef Inline
|
||||
==================
|
||||
|
||||
<div>
|
||||
{% partialdef header inline %}
|
||||
<h1>Title</h1>
|
||||
{% endpartialdef %}
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(partialdef_group
|
||||
name: (push_partial)
|
||||
(template
|
||||
(content))
|
||||
(pop_partial))
|
||||
(content))
|
||||
@@ -0,0 +1,49 @@
|
||||
==================
|
||||
Querystring Empty
|
||||
==================
|
||||
|
||||
{% querystring %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(query_string)
|
||||
(content))
|
||||
|
||||
==================
|
||||
Querystring With Key Value
|
||||
==================
|
||||
|
||||
{% querystring page=2 %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(query_string
|
||||
(identifier)
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Querystring With Identifier And Key Value
|
||||
==================
|
||||
|
||||
{% querystring remove_key page=2 %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(query_string
|
||||
(identifier)
|
||||
(identifier)
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(content))
|
||||
@@ -0,0 +1,18 @@
|
||||
==================
|
||||
Regroup Basic
|
||||
==================
|
||||
|
||||
{% regroup people by gender as grouped %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(regroup
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(attribute)
|
||||
variable: (identifier))
|
||||
(content))
|
||||
@@ -0,0 +1,26 @@
|
||||
==================
|
||||
Resetcycle Bare
|
||||
==================
|
||||
|
||||
{% resetcycle %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(reset_cycle)
|
||||
(content))
|
||||
|
||||
==================
|
||||
Resetcycle With Name
|
||||
==================
|
||||
|
||||
{% resetcycle rowcolors %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(reset_cycle
|
||||
(identifier))
|
||||
(content))
|
||||
@@ -0,0 +1,18 @@
|
||||
==================
|
||||
Spaceless Basic
|
||||
==================
|
||||
|
||||
<div>
|
||||
{% spaceless %}
|
||||
<p> hi </p>
|
||||
{% endspaceless %}
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(spaceless_group
|
||||
(template
|
||||
(content)))
|
||||
(content))
|
||||
@@ -0,0 +1,202 @@
|
||||
==================
|
||||
Template Variable Integer
|
||||
==================
|
||||
|
||||
{{ 42 }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable Negative Float
|
||||
==================
|
||||
|
||||
{{ -3.14 }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable Scientific Notation
|
||||
==================
|
||||
|
||||
{{ 1.5e10 }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable Double Quoted String
|
||||
==================
|
||||
|
||||
{{ "hello world" }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(string)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable Single Quoted String With Escape
|
||||
==================
|
||||
|
||||
{{ 'it\'s ok' }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(string)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable Identifier
|
||||
==================
|
||||
|
||||
{{ name }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable Attribute Access
|
||||
==================
|
||||
|
||||
{{ user.profile.email }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)
|
||||
(attribute)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable With Single Filter
|
||||
==================
|
||||
|
||||
{{ name|upper }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))
|
||||
(filter_expression
|
||||
(filter))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable With Filter Chain
|
||||
==================
|
||||
|
||||
{{ name|lower|title }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))
|
||||
(filter_expression
|
||||
(filter)
|
||||
(filter))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable With Filter Argument
|
||||
==================
|
||||
|
||||
{{ price|add:"5" }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))
|
||||
(filter_expression
|
||||
(filter
|
||||
(value
|
||||
(literal
|
||||
(string)))))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Template Variable Number With Filter Argument
|
||||
==================
|
||||
|
||||
{{ 3.14|floatformat:2 }}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number)))
|
||||
(filter_expression
|
||||
(filter
|
||||
(value
|
||||
(literal
|
||||
(number)))))))
|
||||
(content))
|
||||
@@ -0,0 +1,25 @@
|
||||
==================
|
||||
Templatetag Openblock
|
||||
==================
|
||||
|
||||
{% templatetag openblock %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_tag_block)
|
||||
(content))
|
||||
|
||||
==================
|
||||
Templatetag Closevariable
|
||||
==================
|
||||
|
||||
{% templatetag closevariable %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(template_tag_block)
|
||||
(content))
|
||||
@@ -0,0 +1,69 @@
|
||||
==================
|
||||
Url Basic
|
||||
==================
|
||||
|
||||
{% url 'view-name' %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(url_block
|
||||
(string))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Url With Positional Args
|
||||
==================
|
||||
|
||||
{% url 'view-name' arg1 arg2 %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(url_block
|
||||
(string)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier))))
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Url With Keyword Args
|
||||
==================
|
||||
|
||||
{% url 'view-name' key=val %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(url_block
|
||||
(string)
|
||||
(identifier)
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content))
|
||||
|
||||
==================
|
||||
Url With As
|
||||
==================
|
||||
|
||||
{% url 'view-name' as myurl %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(url_block
|
||||
(string)
|
||||
variable: (identifier))
|
||||
(content))
|
||||
@@ -0,0 +1,61 @@
|
||||
==================
|
||||
With Basic
|
||||
==================
|
||||
|
||||
{% with total=business.employees.count %}
|
||||
{{ total }}
|
||||
{% endwith %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(with_group
|
||||
name: (identifier)
|
||||
variables: (filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)
|
||||
(attribute))))
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content)))
|
||||
(content))
|
||||
|
||||
==================
|
||||
With Multiple Variables
|
||||
==================
|
||||
|
||||
{% with a=1 b=2 %}
|
||||
{{ a }}
|
||||
{% endwith %}
|
||||
|
||||
---
|
||||
|
||||
(template
|
||||
(content)
|
||||
(with_group
|
||||
name: (identifier)
|
||||
variables: (filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number))))
|
||||
name: (identifier)
|
||||
variables: (filtered_value
|
||||
(value
|
||||
(literal
|
||||
(number))))
|
||||
(template
|
||||
(content)
|
||||
(template_variable
|
||||
(filtered_value
|
||||
(value
|
||||
(variable_attribute
|
||||
(identifier)))))
|
||||
(content)))
|
||||
(content))
|
||||
Reference in New Issue
Block a user