Python 在Django中围绕引导html标记封闭For循环

Python 在Django中围绕引导html标记封闭For循环,python,django,python-2.7,django-templates,django-bootstrap3,Python,Django,Python 2.7,Django Templates,Django Bootstrap3,我对Django上的Python非常陌生。我喜欢围绕Django For..循环句柄包装我的引导HTML标记,这样我就可以在列中呈现数据库中的详细信息。然而,从我所做的事情来看,这并没有发生。第二列实际上搞砸了。这些柱子应该并排立着 请注意如果它只有引导标记,那么它的渲染效果会非常好 这是餐厅的图片视图 下面是我的Python Django代码: 模板/app/home.html <!DOCTYPE html> <html lang="en"> <head

我对Django上的Python非常陌生。我喜欢围绕Django For..循环句柄包装我的引导HTML标记,这样我就可以在列中呈现数据库中的详细信息。然而,从我所做的事情来看,这并没有发生。第二列实际上搞砸了。这些柱子应该并排立着

请注意如果它只有引导标记,那么它的渲染效果会非常好

这是餐厅的图片视图

下面是我的Python Django代码:

模板/app/home.html

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>Mentoring Services</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="Mentoring Services">
        <meta name="keywords" content="">
        <meta name="author" content="Myrioi Solutions">
        <!-- FAVICON -->
        <link rel="shortcut icon" href="images/favicon.ico">
        <link rel="stylesheet" href="static/css/base.css">
        {# Load the tag library #}
        {% load bootstrap3 %}

        {# Load CSS and JavaScript #}
        {% bootstrap_css %}
        {% bootstrap_javascript %}

        {# Display django.contrib.messages as Bootstrap alerts #}
        {% bootstrap_messages %}
    </head>
<body>

<div class="intro" data-stellar-background-ratio="0.55" style="background-position: 50% 50%;">
  <div class="container">
      <div>
          <h4>Get mentored and be successful</h4>
      </div>
      <div class="#">
          <h1 style="transition: none; text-align: inherit; line-height: 62px; border-width: 0px; margin: 14px 0px 9px; padding: 0px; letter-spacing: 0px; font-size: 55px; color: black">
            Mentoring Directory
          </h1>
          <p class="lead">The most complete solution<br>
             for online mentoring directories
          </p>
     </div>
  </div>
</div>


<div class="home-directory">
            <div class="container">
                <div class="section-head text-center">
                    <h3>Best rated Mentors</h3>
                    <p class="lead">Explore some of our best mentors around your place and connect with them.</p>
                </div>
                <div class="row">
                 {% for item in mentors %}
                    <div class="col-md-4 col-sm-6 col-sm-offset-3 col-md-offset-0">
                        <div class="listing">
                            <div class="listing-img bg-image" data-image-src="{{ item.image }}" style="background: url(&quot;images/home/3.jpg&quot;) center center / cover no-repeat;">
                                <div class="li-overlay">
                                    <div class="li-overlay-inner">
                                        <a href="#" class="mail"></a>
                                        <a href="#" class="menu"></a>
                                        <a href="#" class="link"></a>
                                    </div>
                                </div>
                            </div>
                            <div class="listing-info">
                                <h4 class="li-name"><a href="#">{{ item.first_name }} {{ item.last_name }}</a></h4>
                                <ul class="list-icon">
                                    <li> <i class="pe-7s-map-marker"></i> {{ item.location }}</li>
                                    <li> <i class="pe-7s-call"></i> {{ item.phone_number }}</li>
                                    <li> <i class="pe-7s-mail"></i> <a href="mailto:{{ item.email }}">{{ item.email }}</a> </li>
                                </ul>
                            </div>
                        </div>
                    {% endfor %}
                    </div>
                </div>
            </div>
        </div>
</body>

</html>

注意:我正在使用package/gem将我的Django应用程序与Bootstrap3集成,我不知道我做错了什么。

我认为问题在于
div
元素和
endfor
的嵌套

循环结束时,没有将所有
匹配。将其从上往下移动一层

        </div>
    {% endfor %}
    </div>
</div>

{%endfor%}


{%endfor%}

我认为问题在于
div
元素和
endfor
的嵌套

循环结束时,没有将所有
匹配。将其从上往下移动一层

        </div>
    {% endfor %}
    </div>
</div>

{%endfor%}


{%endfor%}

wowWWW,你不会相信我已经检查了将近2个小时了。我一定没有想到我做得很好。非常感谢你。我真是太感谢你了。哇,你不会相信我花了将近两个小时才办完手续。我一定没有想到我做得很好。非常感谢你。我对你感激不尽。
        </div>
    </div>
    {% endfor %}
</div>