如何将子弹网址与当前地址进行比较?

时间:2019-03-03 03:02:13

标签: python django django-templates

我有if的静态页面:

{% if request.get_full_path == "billing/address/" %}
    test
{% endif %}

如何用从此处获得的路径替换billing/address/

path('billing/address/<slug:address_slug>/', views.addressChange, name='edit-address')

谢谢大家

1 个答案:

答案 0 :(得分:1)

如果我正确理解了您的问题,则Python的 in 操作人员将发挥作用:)

{% if "billing/address/" in request.get_full_path %}
    test
{% endif %}