Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
Django CMS Placeholder Within Template Block Not Displaying

I am following this tutorial on building a basic blog using the Django CMS and am encountering a strange behavior. It all started when I discovered that the Content area was not being created in the Structure section of the CMS. While investigating it, I discovered the strange behavior.

Here it is.

base.html:

<!-- Main Content -->
<div class="container">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            {% block content %}{% endblock %}
        </div>
    </div>
</div>
<hr>

content.html:

{% extends "base.html" %}
{% load cms_tags %}

{% block content %}
    {% placeholder content or%}
    {% endplaceholder %}
{% endblock content %}

This configuration above displays no Content block on the Structure page of the CMS. However, if I change the base.html snippet to the following, it works.

base.html:

<!-- Main Content -->
<div class="container">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                {% placeholder content or%}
                {% endplaceholder %}
        </div>
    </div>
</div>
<hr>

Could someone tell me why this happens? What am I missing in how Django handles the template blocks? It appears to me that the two cases should be treated identically. Yet, the result is obviously different. The tutorial claims that I should be changing the content.html side. However, as illustrated above, that does not work.

Any elucidation is appreciated!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I was able to resolve this using the following modifications.

base.html:

<!-- Main Content -->
{% placeholder content or %}
<div class="container">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            {% block content %}{% endblock %}
        </div>
    </div>
</div>
<hr>
{% endplaceholder %}  

content.html:

{% extends "base.html" %}
{% load cms_tags %}

{% block content %}
{% endblock content %}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda