Skip to content

Saleor Core: the high performance, composable, headless commerce API.

add content_json to page details view

AlicjaSzu874c89b7a89e
diff --git a/saleor/page/views.py b/saleor/page/views.py
index b23096ae6e..9d5e5c8857 100644
--- a/saleor/page/views.py
+++ b/saleor/page/views.py
@@ -1,4 +1,5 @@
import datetime
+import json
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
@@ -11,5 +12,6 @@ def page_details(request, slug):
today = datetime.date.today()
is_visible = page.publication_date is None or page.publication_date <= today
return TemplateResponse(
- request, "page/details.html", {"page": page, "is_visible": is_visible}
+ request, "page/details.html", {"page": page, "is_visible": is_visible,
+ "content_json": json.dumps(page.translated.content_json)}
)
diff --git a/templates/page/details.html b/templates/page/details.html
index 1840bf56d9..e05eda7390 100644
--- a/templates/page/details.html
+++ b/templates/page/details.html
@@ -4,52 +4,52 @@
{% load build_absolute_uri from urls %}
{% block title %}
- {% if page.seo_title %}
- {{ page.translated.seo_title }}
- {% else %}
- {{ page.translated.title }} - {{ block.super }}
- {% endif %}
+{% if page.seo_title %}
+{{ page.translated.seo_title }}
+{% else %}
+{{ page.translated.title }} - {{ block.super }}
+{% endif %}
{% endblock %}
{% block meta_tags %}
- <meta property="og:title" content="{{ page.translated.seo_title|default:page.translated.title }}">
- <meta property="og:description" content="{{ page.translated.seo_description|default:"" }}">
- <meta name="description" content="{{ page.translated.seo_description|default:"" }}">
+<meta property="og:title" content="{{ page.translated.seo_title|default:page.translated.title }}">
+<meta property="og:description" content="{{ page.translated.seo_description|default:"" }}">
+<meta name="description" content="{{ page.translated.seo_description|default:"" }}">
- {% build_absolute_uri request=request location=page.get_absolute_url as page_url %}
- <meta property="og:url" content="{{ page_url }}">
+{% build_absolute_uri request=request location=page.get_absolute_url as page_url %}
+<meta property="og:url" content="{{ page_url }}">
{% endblock meta_tags %}
{% block breadcrumb %}
- <ul class="breadcrumbs list-unstyled">
- <li>
- <a href="{% url 'home' %}">
- {% trans "Home" context "Main navigation item" %}
- </a>
- </li>
- {% if page %}
- <li>
- <a href="{{ page.get_absolute_url }}">{{ page.translated.title }}</a>
- </li>
- {% endif %}
- </ul>
+<ul class="breadcrumbs list-unstyled">
+ <li>
+ <a href="{% url 'home' %}">
+ {% trans "Home" context "Main navigation item" %}
+ </a>
+ </li>
+ {% if page %}
+ <li>
+ <a href="{{ page.get_absolute_url }}">{{ page.translated.title }}</a>
+ </li>
+ {% endif %}
+</ul>
{% endblock breadcrumb %}
{% block content %}
- {% if not page.is_published %}
- <div class="alert alert-warning" role="alert">
- {% blocktrans context "Unavailable page detail text" %}
- <strong>Warning!</strong>
- You are previewing a page that is not visible.
- {% endblocktrans %}
- </div>
- {% elif not is_visible %}
- <div class="alert alert-warning" role="alert">
- {% blocktrans trimmed with date=page.publication_date|date context "Unpublished page details text" %}
- <strong>Warning!</strong>
- You are previewing a page that will become visible on <strong>{{ date }}</strong>.
- {% endblocktrans %}
- </div>
- {% endif %}
- <div data-description-json='{{ page.translated.content_json }}'></div>
-{% endblock %}
+{% if not page.is_published %}
+<div class="alert alert-warning" role="alert">
+ {% blocktrans context "Unavailable page detail text" %}
+ <strong>Warning!</strong>
+ You are previewing a page that is not visible.
+ {% endblocktrans %}
+</div>
+{% elif not is_visible %}
+<div class="alert alert-warning" role="alert">
+ {% blocktrans trimmed with date=page.publication_date|date context "Unpublished page details text" %}
+ <strong>Warning!</strong>
+ You are previewing a page that will become visible on <strong>{{ date }}</strong>.
+ {% endblocktrans %}
+</div>
+{% endif %}
+<div data-description-json='{{ content_json }}'></div>
+{% endblock %}
\ No newline at end of file