首页 > 解决方案 > 在django中打印href的值时需要删除url

问题描述

我正在尝试打印 href 值,但它与 url 一起出现

HTML

    <style>

        a.printable:link:after,

        a.printable:visited:after {
            content:" [" attr(href) "] ";
        }
    </style>



 <table>
            <tr>
                <td height="40" valign="right" style="width:150px; font-size: 4.2mm; padding:4pt 0pt 0.5pt 0pt; text-align:center; background:#006400;"><a href="{{ request.scheme|safe|escape }}://{{ request.get_host }}/crm/orders/accepting/{{client.id}}/{{invoice.id}}/" class="printable" style="color:#fff; text-decoration:none;">Accept this Order</a></td>

            </tr>
  </table>

这里我真正需要的是

接受此订单

但我得到

接受此订单[http://127.0.0.1:8000/crm/orders/accepting/13/647/]

标签: pythonhtmldjangodjango-viewsdjango-templates

解决方案


推荐阅读