I have two buttons that appointing to different paths. And i want to pass the object.id with parameter.
my urls
urlpatterns = [
path('', admin.site.urls, name ='home'),
path('dpo/imprimir/aprovado/<int:id>/',Aprovado, name ='aprovado'),
path('dpo/imprimir/reprovado/<int:id>/',Reprovado, name ='reprovado'),
]
My views
from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import render_to_response
from .models import Projeto
def Aprovado(request, id):
obj = Projeto.objects.get(id=id)
context = {
"object": obj
}
return render(request, "dpo/imprimir/aprovado.html", context)
def Reprovado(request, id):
obj = Projeto.objects.get(id=id)
context = {
"object": obj
}
return render(request, "dpo/imprimir/reprovado.html", context)
** My template**
{% load i18n admin_urls %}
{% block object-tools-items %}
<li>
<a href="{% url 'aprovado' object.id %}">{% trans "Aprovado" %}</a></a>
</li>
<li>
<a href="{% url 'reprovado' object.id %}">{% trans "Aprovado" %}</a>
</li>
{% endblock %}
i think i am doing this the wrong way