0
respostas

NoReverseMatch at /home Reverse for 'deletar' with arguments '(1,)' not found. 1 pattern(s) tried: ['del/<int:manut_id\\Z']

não consigo deletar um obj porfavor podem me ajudar Insira aqui a descrição dessa imagem para ajudar na acessibilidade aqui esta as views

from django.shortcuts import render, redirect, get_object_or_404
from .models import manut

# Create your views here.
def index(request):
    return render(request,'index.html')

def home(request):
    manutenc = manut.objects.all()
    dados = {
        'manutenc': manutenc
    }
    return render(request,'home.html',dados)

def manutencao(request):
    return render(request,'manutencao.html')

def deleta(request,manut_id):
    manuten = get_object_or_404(manut,id=manut_id)
    manuten.delete()
    return redirect('home')

def uma_manut(request,manut_id):
    manuten = get_object_or_404(manut,id=manut_id)
    dados = {
        'manuten': manuten
    }
    return render(request,'uma-manut.html',dados)

e o template

{% load static %}
<!DOCTYPE html>
<html>
    <head>
        {% include 'partial/links.html'%}
        <link rel="stylesheet" href="{% static 'css/home.css'%}">
        <title>home</title>
    </head>
    <body>
        <header class="header">
            <ul>
                <li class="li1"><a href="{% url 'manute'%}">manutençao</a></li>
                <li><a href="{% url 'inicial'%}">home</a>
                    <ul>
                        <li><a href="">criar mnt</a></li>
                        <li><a href="{% url 'pagina'%}">index</a></li>
                    </ul>
                </li>
            </ul>
        </header>

        <main class="main">
            {% if manutenc %}
                {% for manute in manutenc %}
                    <div class="main-div">
                        {% if manute.imagem == ''%}
                            <img src="{% static 'img/bandera-rio.jpg' %}" alt="" class="img-div">
                        {% else %}
                            <img src="{{ manute.imagem.url }}" alt="" class="img-div">
                        {% endif %}
                        <h1 class="h1-div">manutençao feita:</br>{{manute.nome}}</h1>
                        <p>{{ manute.tipo }}</p>
                        <div class="div-div">
                            <a href="{% url 'deletar' manute.id %}" type="button" class="botao-d">{{manute.id}}</a>
                            <input type="submit" value="edita" class="botao">
                        </div>
                    </div>
                {% endfor %}
                {% else %}
            {% endif %}
        </main>
    </body>
</html>