Commit 1cf3c566 authored by Robin Tissot's avatar Robin Tissot
Browse files

Fixes last edited link and add a delete button in the document list.

parent 60623bb8
......@@ -244,6 +244,13 @@ class Document(models.Model):
return 'ltr'
def last_edited_part(self):
except IndexError:
return None
def training_model(self):
return self.ocr_models.filter(training=True).first()
......@@ -49,11 +49,18 @@
<td class="text-right">
{# <a href="{% url 'document-detail' %}" class="btn btn-info disabled" title="{% trans 'View' %}"><i class="fas fa-eye"></i></a> #}
{# Note that doing one query per row is a lot faster than a subquery for some reason #}
<a href="{% url 'document-part-edit' %}"
{% if document.last_edited_part %}
<a href="{% url 'document-part-edit' %}"
class="btn btn-info"
title="{% trans 'Edit last updated Element' %}">
<i class="fas fa-edit"></i>
<i class="fas fa-edit"></i>
{% endif %}
<form method="post" class="inline-form" action="{% url 'document-publish' %}" onsubmit="return confirm('{% trans "Do you really want to delete the document?" %}');">{% csrf_token %}
<input type="hidden" name="workflow_state" value="{{ document.WORKFLOW_STATE_ARCHIVED }}">
<button type="submit" value="" class="nav-item btn btn-danger" title="{% trans 'Delete' %}"><i class="fas fa-trash"></i></button>
{% endfor %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment