Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
内联块不适用于Python Django_Python_Css_Django - Fatal编程技术网

内联块不适用于Python Django

内联块不适用于Python Django,python,css,django,Python,Css,Django,所以这个问题让我抓狂,因为我认为display:inline块可以工作,但Python Django似乎不是这样。我不确定我的css是坏的还是python代码。我是python的新手,所以请原谅这看起来有多新手 模板: <article class="article top-buffer {% if article.is_featured %} featured{% endif %} {% if not article.published %} unpublished{% endif %}

所以这个问题让我抓狂,因为我认为display:inline块可以工作,但Python Django似乎不是这样。我不确定我的css是坏的还是python代码。我是python的新手,所以请原谅这看起来有多新手

模板:

<article class="article top-buffer
{% if article.is_featured %} featured{% endif %}
{% if not article.published %} unpublished{% endif %}">

{% if not detail_view %}
<div class="hg-box">
    <div>
        <img src="{% thumbnail article.featured_image 1200x400 crop subject_location=article.featured_image.subject_location %}" class="img-responsive product-main-image">
    </div>
    <div class="post-preview hg-post">
        <a href="{% namespace_url 'article-detail' article.slug namespace=namespace default='' %}">
            <h2 class="post-title">
            {% render_model article "title" "" "" "striptags" %} 
            </h2>
            {% if article.lead_in %}
            <h3 class="post-subtitle">
                {% if not detail_view %}
                    {% render_model article "lead_in" "" "" "truncatewords:'20'|striptags" %} 
                {% else %}
                    {% render_model article "lead_in" "" "" "striptags" %} 
                {% endif %}
            </h3>
            {% endif %}
        </a>
        {% include "aldryn_newsblog/includes/date.html" %}
    </div>
</div>
{% endif %}


{% if detail_view %}
    {% render_placeholder article.content language placeholder_language %}
{% endif %}
后期预览只是文本相关的,所以我没有包括它。这里是一个网站的图片,我想做什么

查看图片可能会有点困惑,因为其中涉及一些引导。这是您的权利,因为在Django CMS中,我可以在内部添加行和列。如果你想要一个简单的网站建设者,这真的很酷,而且是由divio cloud提供的。这是结构树的图片

您在第一张图像中看到的缩略图是结构树中最新文章的一部分。时事通讯注册是新闻表单。两者都被分成各自的列

如果您想知道{%If not detail_view%}是什么,下面是文章详细信息的代码

{{% block title %}
{{ article.title }} - {{ block.super }}
{% endblock %}

{% block header %}
<!-- Set your background image for this header on the line below. -->
<header class="intro-header" style="background-image: url(
{% if article.featured_image_id %}
    {% thumbnail article.featured_image 1200x400 crop subject_location=article.featured_image.subject_location %}
{% else %}
    {% static 'img/post-bg.jpg' %}
{% endif %}
)">
    <div class="container hg-cover">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <h1>{% render_model article "title" "" "" "striptags" %}</h1>
                    <h2 class="subheading">{% render_model article "lead_in" "" "" "striptags" %}</h2>
                    {% include "aldryn_newsblog/includes/date.html" %}
                </div>
            </div>
        </div>
    </div>
</header>
{% endblock %}

{% block newsblog_content %}
{% include "aldryn_newsblog/includes/article.html" with detail_view="true" %}

{% static_placeholder "newsblog_social" %}

<ul class="pager">
    {% if prev_article %}
        <li><a href="{{ prev_article.get_absolute_url }}">{% trans "Previous Article" %}</a></li>
    {% endif %}
    <li><a href="{% namespace_url "article-list" %}">{% trans "Back to Overview" %}</a></li>
    {% if next_article %}
        <li><a href="{{ next_article.get_absolute_url }}">{% trans "Next Article" %}</a></li>
    {% endif %}
</ul>
{% endblock %}}enter code here
{{%block title%}
{{article.title}}-{{block.super}
{%endblock%}
{%块头%}
{%render_模型文章“title”“”“”“striptags”%}
{%render_模型文章“lead_in”“”“”“striptags”%}
{%include“aldryn_新闻博客/includes/date.html”%}
{%endblock%}
{%block newsblog_content%}
{%include“aldryn_newsblog/includes/article.html”和detail_view=“true”%}
{%static\u占位符“newsblog\u social”%}
    {%if上一篇文章%}
  • {%endif%}
  • {%if下一篇文章%}
  • {%endif%}
{%endblock%}}在此处输入代码

任何建议都会大有帮助。如果这很难理解,我道歉。如果需要,我当然可以提供更多信息

试着把盒子弄小一点。如果没有足够的空间容纳两个框,它将不会内联。这只是css的问题,而不是django。内联块规则:
.hg box{display:inline block;}
后是否有分号?在上面的代码中,你没有。分号不在那里,因为它来自css.min文件,是的,我试图使框变小,但没有运气。我找到了答案。我的CSS影响了这些文章所在的模板,但这导致了一个新问题。最新的文章和特色文章共享同一个模板,所以现在我倒退了几个步骤。
{{% block title %}
{{ article.title }} - {{ block.super }}
{% endblock %}

{% block header %}
<!-- Set your background image for this header on the line below. -->
<header class="intro-header" style="background-image: url(
{% if article.featured_image_id %}
    {% thumbnail article.featured_image 1200x400 crop subject_location=article.featured_image.subject_location %}
{% else %}
    {% static 'img/post-bg.jpg' %}
{% endif %}
)">
    <div class="container hg-cover">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <h1>{% render_model article "title" "" "" "striptags" %}</h1>
                    <h2 class="subheading">{% render_model article "lead_in" "" "" "striptags" %}</h2>
                    {% include "aldryn_newsblog/includes/date.html" %}
                </div>
            </div>
        </div>
    </div>
</header>
{% endblock %}

{% block newsblog_content %}
{% include "aldryn_newsblog/includes/article.html" with detail_view="true" %}

{% static_placeholder "newsblog_social" %}

<ul class="pager">
    {% if prev_article %}
        <li><a href="{{ prev_article.get_absolute_url }}">{% trans "Previous Article" %}</a></li>
    {% endif %}
    <li><a href="{% namespace_url "article-list" %}">{% trans "Back to Overview" %}</a></li>
    {% if next_article %}
        <li><a href="{{ next_article.get_absolute_url }}">{% trans "Next Article" %}</a></li>
    {% endif %}
</ul>
{% endblock %}}enter code here