#18 File upload in certain folders

* refactors documents and file upload to be distributed into different subfolders, depending on the type of document (InterventionDocument, RevocationDocument, ...)
* refactors Document model into AbstractDocument
* subclasses RevocationDocument, InterventionDocument, COmpensationDocument, EmaDocument and EcoAccountDocument from AbstractDocument to provide proper functionality for each
* adds new specialized routes for each new document type (opening, removing)
* drops generic get and remove routes for documents
This commit is contained in:
mipel
2021-09-01 16:24:49 +02:00
parent 17d574e2a5
commit f64a11cb50
25 changed files with 437 additions and 109 deletions

View File

@@ -39,14 +39,14 @@
{% for doc in intervention.documents.all %}
<tr>
<td class="align-middle">
<a href="{% url 'doc-open' doc.id %}">
<a href="{% url 'intervention:get-doc' doc.id %}">
{{ doc.title }}
</a>
</td>
<td class="align-middle">{{ doc.comment }}</td>
<td>
{% if is_default_member and has_access %}
<button data-form-url="{% url 'doc-remove' doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove document' %}">
<button data-form-url="{% url 'intervention:remove-doc' doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove document' %}">
{% fa5_icon 'trash' %}
</button>
{% endif %}

View File

@@ -31,10 +31,10 @@
{% trans 'From' context 'Revocation' %}
</th>
<th scope="col">
{% trans 'Comment' %}
{% trans 'Document' %}
</th>
<th scope="col">
{% trans 'Document' %}
{% trans 'Comment' %}
</th>
<th scope="col">
{% trans 'Action' %}
@@ -48,14 +48,14 @@
<td class="align-middle">
{{ rev.date }}
</td>
<td class="align-middle">{{ rev.comment }}</td>
<td class="align-middle">
{% if rev.document %}
<a href="{% url 'doc-open' rev.document.id %}">
{{ rev.document.file }}
<a href="{% url 'intervention:get-doc-revocation' rev.document.id %}">
{% trans 'Revocation' %}
</a>
{% endif %}
</td>
<td class="align-middle">{{ rev.comment }}</td>
<td>
{% if is_default_member and has_access %}
<button data-form-url="{% url 'intervention:remove-revocation' rev.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove revocation' %}">