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.

1 Answer 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
1
  • Thank you so much. I thought that "{% load placeholder_tags %}" belonged in "base.html", moving it to the other template which extends "base.html" did the trick. Oct 2, 2013 at 3:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.