mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
improved deletion of recipes
This commit is contained in:
@@ -22,13 +22,11 @@
|
||||
</div>
|
||||
{{ form|crispy }}
|
||||
|
||||
{% if related_objects %}
|
||||
{% blocktrans %} <i>{{ object }}</i> could not be deleted because it is still referenced by the following instances: {% endblocktrans %}
|
||||
<br/>
|
||||
<br/>
|
||||
{% for o in related_objects %}
|
||||
{% 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 %}
|
||||
<h5>{{ name }}</h5>
|
||||
<u>{{ name }}</u>
|
||||
<ul>
|
||||
{% for e in o %}
|
||||
<li>
|
||||
@@ -36,14 +34,40 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<br/>
|
||||
{% endif %}
|
||||
|
||||
<button class="btn btn-success" type="submit" href="{{ success_url }}"><i
|
||||
{% 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>
|
||||
|
||||
Reference in New Issue
Block a user