Exclude main content from spaceless
This commit is contained in:
parent
bb1f2a7838
commit
06205dbaea
2 changed files with 4 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
{% load static compress %}
|
||||
{% spaceless %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% spaceless %}
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
@ -35,12 +35,14 @@
|
|||
<p>{{ blog_description }}</p>
|
||||
{% include "articles/snippets/navigation.html" %}
|
||||
</header>
|
||||
{% endspaceless %}
|
||||
|
||||
<main>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
|
||||
{% spaceless %}
|
||||
<footer>
|
||||
<hr>
|
||||
<p>
|
||||
|
@ -64,5 +66,5 @@
|
|||
{% endcompress %}
|
||||
|
||||
</body>
|
||||
{% endspaceless %}
|
||||
</html>
|
||||
{% endspaceless %}
|
||||
|
|
|
@ -50,16 +50,9 @@ def _assert_article_is_rendered(item: Article, res):
|
|||
content = res.content.decode("utf-8")
|
||||
assert item.title in content
|
||||
html = item.get_formatted_content
|
||||
html = get_spaceless_html(html)
|
||||
assert html in content
|
||||
|
||||
|
||||
def get_spaceless_html(html):
|
||||
context = Context({})
|
||||
html = Template("{% spaceless %}" + html + "{% endspaceless %}").render(context)
|
||||
return html
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_anonymous_cant_access_draft_detail(
|
||||
client: Client, unpublished_article: Article
|
||||
|
|
Reference in a new issue