擅长:python、mysql、java
<p>您可以将所有活动段塞的列表发送到模板,然后构建自定义模板过滤器来构造修改后的url。在</p>
<h3>在视图.py</h3>
<pre><code># Send your list of active slugs to the template
return render(request, 'category.html', {
'active_filters': active,
'inactive_filters': inactive,
'slugs': slugs,
})
</code></pre>
<h3>标签_过滤器.py</h3>
^{pr2}$
<h3>你的模板</h3>
<pre><code>{% for object in active_filters %}
<li>
<a href="{{ object|remove_filter:slugs }}"><i class="icon-remove"></i></a>{{ object }}
</li>
{% endfor %}
</code></pre>