Using object's id in change_form_object_tools.html template

末鹿安然 提交于 2019-12-02 13:19:55

In the change_form_object_tools.html template, you should be able to access the object using original.

{% load i18n admin_urls %}
{% block object-tools-items %}
<li>
    <a href="{% url 'aprovado' original.pk  %}">{% trans "Aprovado" %}</a></a>
</li>
<li>

    <a href="{% url 'reprovado' original.pk  %}">{% trans "Aprovado" %}</a>
</li>
{% endblock %}

In general, you can use the {% debug %} tag or django-debug-toolbar to check what variables are in the template context.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!