Ticket #24555: repro-24555.diff

File repro-24555.diff, 3.1 KB (added by Baptiste Mispelon, 10 years ago)

Reproduction testcase

  • new file tests/issue24555/templates/issue24555.html

    diff --git a/tests/issue24555/__init__.py b/tests/issue24555/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/issue24555/templates/issue24555.html b/tests/issue24555/templates/issue24555.html
    new file mode 100644
    index 0000000..72b32d0
    - +  
     1{% load tags %}
     2<!DOCTYPE html>
     3<html>
     4<body>
     5{% show_widget_1 'hello' %}
     6{% show_widget_2 'hello 2' %}
     7</body>
     8</html>
  • new file tests/issue24555/templates/widget_1.html

    diff --git a/tests/issue24555/templates/widget_1.html b/tests/issue24555/templates/widget_1.html
    new file mode 100644
    index 0000000..ddaf0df
    - +  
     1{% extends wrapper %}
     2
     3
     4{% block content %}
     5    <div>
     6        <h1>{{ title }}</h1>
     7        content 1
     8    </div>
     9{% endblock %}
  • new file tests/issue24555/templates/widget_2.html

    diff --git a/tests/issue24555/templates/widget_2.html b/tests/issue24555/templates/widget_2.html
    new file mode 100644
    index 0000000..71b7a2b
    - +  
     1
     2{% extends wrapper %}
     3
     4
     5{% block content %}
     6    <div>
     7        <h1>{{ title }}</h1>
     8        content 2
     9    </div>
     10{% endblock %}
     11
  • new file tests/issue24555/templates/wrapper_1.html

    diff --git a/tests/issue24555/templates/wrapper_1.html b/tests/issue24555/templates/wrapper_1.html
    new file mode 100644
    index 0000000..9b5178d
    - +  
     1{% block content %}{% endblock content %}
  • new file tests/issue24555/templates/wrapper_2.html

    diff --git a/tests/issue24555/templates/wrapper_2.html b/tests/issue24555/templates/wrapper_2.html
    new file mode 100644
    index 0000000..9b5178d
    - +  
     1{% block content %}{% endblock content %}
  • new file tests/issue24555/templatetags/tags.py

    diff --git a/tests/issue24555/templatetags/__init__.py b/tests/issue24555/templatetags/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/issue24555/templatetags/tags.py b/tests/issue24555/templatetags/tags.py
    new file mode 100644
    index 0000000..12e5e04
    - +  
     1from django import template
     2
     3register = template.Library()
     4
     5@register.inclusion_tag('widget_1.html')
     6def show_widget_1(title):
     7    return {
     8        'title': title,
     9        'wrapper': 'wrapper_1.html',
     10    }
     11
     12
     13@register.inclusion_tag('widget_2.html')
     14def show_widget_2(title):
     15    return {
     16        'title': title,
     17        'wrapper': 'wrapper_2.html',
     18    }
  • new file tests/issue24555/tests.py

    diff --git a/tests/issue24555/tests.py b/tests/issue24555/tests.py
    new file mode 100644
    index 0000000..f4b663c
    - +  
     1from django.template import Context
     2from django.template.loader import get_template
     3from django.test import TestCase
     4
     5
     6class ReproductionTestCase(TestCase):
     7    def test_reproduction(self):
     8        tpl = get_template('issue24555.html')
     9        rendered = tpl.render(Context())
     10        expected = '''
     11<!DOCTYPE html>
     12<html>
     13    <body>
     14        <div>
     15            <h1>hello</h1>
     16            content 1
     17        </div>
     18        <div>
     19            <h1>hello 2</h1>
     20            content 2
     21        </div>
     22    </body>
     23</html>'''
     24        self.assertHTMLEqual(rendered, expected)
Back to Top