Y
Y
YuriyCherniy2020-01-19 14:19:47
Django
YuriyCherniy, 2020-01-19 14:19:47

How does the confirme_delete.html form work in Django?

I have a form that is called by the standard dzhang DeleteView.

<form method="POST">{% csrf_token %}
        <fieldset class="form-group">
            <legend class="border-bottom mb-4">Это действие приведёт к удалению товара с главной страницы!</legend>
            <h2>Удалить товар - {{ object }}?</h2>
        </fieldset>
        <button class="btn btn-danger" type="submit">Да</button>
        <a class="btn btn-secondary" href="{% url 'item_detail_url' object.pk %}">Отменить</a>
    </form>

How does Django know that an object needs to be deleted? After all, nothing is transmitted to the server, only the csrf token. Or does the attribute type="submit"have some other meaning besides submitting form data, which is not present in this example?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question