<i id='k5vfN'><tr id='k5vfN'><dt id='k5vfN'><q id='k5vfN'><span id='k5vfN'><b id='k5vfN'><form id='k5vfN'><ins id='k5vfN'></ins><ul id='k5vfN'></ul><sub id='k5vfN'></sub></form><legend id='k5vfN'></legend><bdo id='k5vfN'><pre id='k5vfN'><center id='k5vfN'></center></pre></bdo></b><th id='k5vfN'></th></span></q></dt></tr></i><div id='k5vfN'><tfoot id='k5vfN'></tfoot><dl id='k5vfN'><fieldset id='k5vfN'></fieldset></dl></div>

    1. <tfoot id='k5vfN'></tfoot>
        <bdo id='k5vfN'></bdo><ul id='k5vfN'></ul>

      <small id='k5vfN'></small><noframes id='k5vfN'>

    2. <legend id='k5vfN'><style id='k5vfN'><dir id='k5vfN'><q id='k5vfN'></q></dir></style></legend>

      模板包括和 django 视图/网址.他们如何(做/应该)工作?

      Template includes and django views/urls. How (do/should) they work?(模板包括和 django 视图/网址.他们如何(做/应该)工作?)
        <i id='bTLUy'><tr id='bTLUy'><dt id='bTLUy'><q id='bTLUy'><span id='bTLUy'><b id='bTLUy'><form id='bTLUy'><ins id='bTLUy'></ins><ul id='bTLUy'></ul><sub id='bTLUy'></sub></form><legend id='bTLUy'></legend><bdo id='bTLUy'><pre id='bTLUy'><center id='bTLUy'></center></pre></bdo></b><th id='bTLUy'></th></span></q></dt></tr></i><div id='bTLUy'><tfoot id='bTLUy'></tfoot><dl id='bTLUy'><fieldset id='bTLUy'></fieldset></dl></div>

        1. <small id='bTLUy'></small><noframes id='bTLUy'>

            <tfoot id='bTLUy'></tfoot>
              <tbody id='bTLUy'></tbody>

                <bdo id='bTLUy'></bdo><ul id='bTLUy'></ul>
              • <legend id='bTLUy'><style id='bTLUy'><dir id='bTLUy'><q id='bTLUy'></q></dir></style></legend>

              • 本文介绍了模板包括和 django 视图/网址.他们如何(做/应该)工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个迷你框,当悬停时会弹出以显示个人资料信息(一直隐藏).由于模板包括:

                I have a mini box that pops up when hovered to reveal profile information(constantly being hidden). It's working due to a template include:

                {% for i in leftbar_network|slice:":12" %}
                     {% include "includes/mini_profile.html" %} 
                {% endfor %}
                

                但我想添加一些条件并提取其他信息……例如:检查它们是否可以发送消息.拉那个特定的个人资料朋友数.. yadda yadda.我有一个应该可以工作的网址和视图.但似乎它们被完全忽略了.

                But I want to add some conditions and pull other information... for instance: check if they can be messaged. pull that specific profiles friend count.. yadda yadda. I have a url and view that should work. But it seems as though they're being completely ignored.

                模板:

                <div class="mini-profile">
                    <div class="mini-profile-top">
                        <a href="/profile/{{i.get_type|lower}}/{{ i.user.username }}/" data-title="{{ i.user.get_full_name }}" data-content="{{i.get_type}}">
                            <img class="img-frame" width="90" height="90" src="{% if i.avatar %}{% thumbnail i.avatar 120x120 crop %}{% else %}{{ DEFAULT_AVATAR }}{% endif %}" alt="{{ i.user.get_full_name }}" />
                        </a>
                        <a href="/profile/{{i.get_type|lower}}/{{ i.user.username }}/" data-title="{{ i.user.get_full_name }}" data-content="{{i.get_type}}">{{ i.user.get_full_name }}</a>
                        <div>{{ i.get_type }}</div>
                    </div>
                    <div class="mini-profile-bottom">
                        {% if can_message %}
                        <form method="GET" action="/messages/compose/{{ i.get_type|lower }}/{{ i.user.username }}/">
                            <button class="btn btn-margin" type="submit">
                                <i class="icon-envelope"></i> Message
                            </button>
                        </form>
                        {% else %}
                        <button class="btn btn-margin tooltip-bottom disabled" title="You need to be connected to message {{profile.user.get_full_name}}" type="submit">
                            <i class="icon-envelope"></i> Message
                        </button>
                        {% endif %}
                    </div>
                </div>
                

                有什么方法可以使用 {% include %} 并围绕它生成视图?还是我走错了路?如果是这样,我应该如何生成一个带有平滑弹出视图和url的迷你框?

                Is there any way to work with the {% include %} and generate a view around that? Or have I gone about this the wrong way? If so, how should I generate a mini box with a view and url that pops up smoothly?

                示例:Google 聊天,当鼠标悬停在用户上时.

                Example: Google chat, when hovering over a user.

                提前感谢您的建议.

                推荐答案

                我想添加一些条件并提取其他信息...实例:检查是否可以向他们发送消息.拉出特定的配置文件好友数

                I want to add some conditions and pull other information... for instance: check if they can be messaged. pull that specific profiles friend count

                听起来您正在寻找模板标签,对于 包含标签,更具体一点.

                Sounds like your are looking for a template tag, for an inclusion tag, to be more specific.

                因此,您可以将 (python/view) 逻辑放入您的标签中,并呈现与您的包含类似的适当 html.

                So you can put the (python/view) logic in your tag and render the appropiate html similiar to your include.

                这篇关于模板包括和 django 视图/网址.他们如何(做/应该)工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)

                <small id='57e04'></small><noframes id='57e04'>

              • <legend id='57e04'><style id='57e04'><dir id='57e04'><q id='57e04'></q></dir></style></legend><tfoot id='57e04'></tfoot>

                1. <i id='57e04'><tr id='57e04'><dt id='57e04'><q id='57e04'><span id='57e04'><b id='57e04'><form id='57e04'><ins id='57e04'></ins><ul id='57e04'></ul><sub id='57e04'></sub></form><legend id='57e04'></legend><bdo id='57e04'><pre id='57e04'><center id='57e04'></center></pre></bdo></b><th id='57e04'></th></span></q></dt></tr></i><div id='57e04'><tfoot id='57e04'></tfoot><dl id='57e04'><fieldset id='57e04'></fieldset></dl></div>
                        <tbody id='57e04'></tbody>
                        <bdo id='57e04'></bdo><ul id='57e04'></ul>