0

I'm trying to render a placeholder in my template, that I've put into a custom CMS plugin. The problem is it's telling me that the 'render_placeholder' tag is an invalid block tag.

Here's the template with the 'render_placeholder' tag.

{% extends 'base.html' %}

{% block base_content %}

<h2>Posts</h2>
{% if posts %}
    {% for post in posts %}
    <div class="entry-list">
        {{ post.posted|date:"M d" }}
        <h3><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3>
            {% render_placeholder post.body %}
        <a href="{{ post.get_absolute_url }}">Read More</a>
        </div>
    {% endfor %}
{% else %}
    <p>There are no posts.</p>
{% endif %}

{% endblock %}

Here's the base template showing the '{% load placeholder_tags %}'.

{% load placeholder_tags cms_tags sekizai_tags static menu_tags %}
<html>
<head>
    {% render_block "css" %}
    <link href="{{ STATIC_URL }}css/styles.css" rel="stylesheet">
</head>
<body>
  {% show_menu 0 100 100 100 %}
  {% cms_toolbar %}
  {% placeholder base_content %}
  {% block base_content %}{% endblock %}
  {% render_block "js" %}
</body>
</html>

It keeps telling me "Invalid block tag: 'render_placeholder', expected 'empty' or 'endfor'".

Am I missing something stupid?

Thanks in advance.

4

1 回答 1

2
{% load placeholder_tags %}

Put that in your template which calls placeholder.

I would need to see your project folder structure as well to make sure the source of that tag is accessible. It should be in an app with the folder named:

<app_name>/templatetags
<app_name>/models.py
于 2013-10-02T03:53:18.917 回答