TandoorRecipes/cookbook/templates/generic/delete_template.html
2021-11-04 12:27:21 +01:00

77 lines
2.8 KiB
HTML

{% extends "base.html" %}
{% load custom_tags %}
{% load custom_tags %}
{% load crispy_forms_tags %}
{% load i18n %}
{% block title %}{% trans 'Delete' %} - {{ title }}{% endblock %}
{% block extra_head %}
{{ form.media }}
{% endblock %}
{% block content %}
<h3>{% trans 'Delete' %} {{ title }}</h3>
<form action="." method="post">
{% csrf_token %}
<div class="alert alert-warning" role="alert">
{% blocktrans %}Are you sure you want to delete the {{ title }}: <b>{{ object }}</b> {% endblocktrans %}
</div>
{{ form|crispy }}
{% if protected_objects %}
<h5>{% trans 'Protected' %} <small class="text-muted">The object you are trying to delete is <b>protected</b> by the following references to it.</small></h5>
{% for o in protected_objects %}
{% class_name o.model as name %}
<u>{{ name }}</u>
<ul>
{% for e in o %}
<li>
<span class="badge badge-info">#{{ e.id }}</span> {{ e }}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endif %}
{% if cascading_objects %}
<h5>{% trans 'Cascade' %} <small class="text-muted">The object you are trying to delete is used by the following objects which will <b>also be deleted</b>.</small></h5>
{% for o in cascading_objects %}
{% class_name o.model as name %}
<u>{{ name }}</u>
<ul>
{% for e in o %}
<li>
<span class="badge badge-info">#{{ e.id }}</span> {{ e }}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endif %}
{% if set_null_objects %}
<h5>{% trans 'Remove' %} <small class="text-muted">The object you are trying to delete is used by the following objects from which the reference will be removed.</small></h5>
{% for o in set_null_objects %}
{% class_name o.model as name %}
<u>{{ name }}</u>
<ul>
{% for e in o %}
<li>
<span class="badge badge-info">#{{ e.id }}</span> {{ e }}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endif %}
<button class="btn btn-success" type="submit" href="{{ success_url }}" {% if protected_objects %}disabled{% endif %}><i
class="fas fa-trash-alt"></i> {% trans 'Confirm' %}</button>
<a href="javascript:history.back()" class="btn btn-danger"><i class="fas fa-undo-alt"></i> {% trans 'Cancel' %}
</a>
</form>
{% endblock %}